|
|
|
ANSI & T-SQL specific solutions for getting the 2nd recent date from a set of values. This can be extended to answer nth date from a set of values but the ANSI version gets unwieldy & has to be modified for bigger values. |
Click here to copy the following block | SELECT MIN( t1.updatedate ) AS "2ndRecentDate" FROM sysusers AS t1 WHERE t1.updatedate = ( SELECT MAX( t2.updatedate ) FROM sysusers AS t2 WHERE t2.updatedate < ( SELECT MAX( t3.updatedate ) FROM sysusers AS t3 ) )
GO
SELECT TOP 1 t.updatedate AS "2ndRecentDate" FROM ( SELECT TOP 2 updatedate FROM sysusers ORDER BY updatedate DESC ) AS t ORDER BY t.updatedate
GO |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|