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 2005 Forums
 Transact-SQL (2005)
 get last 3 updated date

Author  Topic 

thendraljazz
Starting Member

26 Posts

Posted - 2011-12-07 : 00:29:25
Hi

I have data based on updated date in the table.
so now i need to get last 3 updated dates which is having records in table.
How can i do this..

give me a solution...

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-07 : 00:32:41
[code]
select top 3 *
from yourtable
order by update_date desc
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-07 : 00:40:09
[code]
select top 3 with ties *
from yourtable
order by update_date desc
[/code]

in case you've multiple records within last 3 update dates and have to retrieve all of them



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -