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 2008 Forums
 Transact-SQL (2008)
 Select query to get the oldest row based on date

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2011-03-14 : 10:14:11
How can i get a single row from documents table, has the oldest datetime stamp.

select username from tableDocuments where docid=43 and updated_Date is the oldest.

thank you for the helpful info.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-03-14 : 10:21:51
select userName,min(updated_date)
from tableDocuments
where docid = 43
group by userName

Jim

Now what is it that you're really after?

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -