Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 top 3 dates

Author  Topic 

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-05-04 : 16:42:31
I was wondering if there was a way to select the 3 most recent dates based on certain criteria eg

Name Date
------- -----------------------
John 2007-07-07 09:20:00.000
John 2007-05-07 09:20:00.000
John 2007-07-14 09:00:00.000
John 2007-05-07 10:00:00.000
Mary 2007-07-06 12:20:00.000
Mary 2007-05-04 13:20:00.000
Mary 2007-07-12 15:00:00.000
Mary 2007-05-01 10:00:00.000


would yield

Name Date
------- -----------------------
John 2007-05-07 09:20:00.000
John 2007-05-07 10:00:00.000
John 2007-07-07 09:20:00.000
Mary 2007-05-01 10:00:00.000
Mary 2007-05-04 13:20:00.000
Mary 2007-07-06 12:20:00.000

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-04 : 17:51:15
http://weblogs.sqlteam.com/mladenp/archive/0001/01/01/7421.aspx
point 2.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -