Hi coool_sweet,
If I understand correctly, you want to return the results that the enddate column equal to ’99/99/9999’, current is not null and current date is at least 1 month after the date column. If in this scenario, please refer to the query below:
create table #TEMP (memberid int,programid int,[current] int,previous int,[date] date, enddate varchar(500))
insert into #TEMP Values (1,1,12,null,'01/02/2013','02/04/2013'),
(1,1,13,12,'03/04/2014','99/99/9999')
select * from #TEMP
where enddate='99/99/9999' and ([current] is not null) and DATEADD(month, -1, GETDATE())>[date]
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
No comments:
Post a Comment