What is the way to reterieve the latest date, Last date before that .....I need to use this for version maintenance table.
I need to do this withouth doing max...below is my query
declare
@version varchar(10)='@VERSION'
--declare @version varchar(10)= 'Daily Planet'
update
dbo.Version_Controlset [VERSION TYPE]='Previous'wheredatediff(d,[SUBMISSION DATE],(getdate()))= 1
update
dbo.Version_Controlset [VERSION TYPE]='Archive'wheredatediff(d,[SUBMISSION DATE],getdate())> 1
if
exists(select [VERSION TYPE] fromversionwhere [SUBMISSION DATE]=convert(char(10),getdate(),101)
and dbo.Version_Control=@versionand [type]='Current')
and
notexists(select [VERSION TYPE] fromversionwhere [SUBMISSION DATE]=convert(char(10),(getdate()),101)
and dbo.Version_Control=@versionand [VERSION TYPE]='Final')
update dbo.Version_Controlset [VERSION TYPE]='Current'wheredatediff(d,[SUBMISSION DATE],getdate())=0
else
update dbo.Version_Controlset [VERSION TYPE]='Archive'wheredatediff(d,[SUBMISSION DATE],(getdate()))= 0
---------------------------
SPPandey