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)
 Retrieve Most Recent date

Author  Topic 

ladiaocb
Yak Posting Veteran

57 Posts

Posted - 2006-05-01 : 12:03:34
Hey All,

I have a query that I just can't seem to get. I have the following table and we'll call it tbl1:

tbl1

Modify_date_time-----------UserID----LoginID
2004-06-07 10:23:38.000---1000------8001
2005-04-06 10:23:38.000---1000------8050
2006-08-19 08:53:01.000---1000------8080

I would like to retrieve the most recent LoginID given the recent modified date. Please help!

mmarovic
Aged Yak Warrior

518 Posts

Posted - 2006-05-01 : 12:26:50
[code]select top 1 a.loginID
from tbl1 a
order by modify_date_time desc[/code]Hopefully you have an index on modify_date_time.
Go to Top of Page

ladiaocb
Yak Posting Veteran

57 Posts

Posted - 2006-05-01 : 12:43:59
I do and this works perfect thanks!
Go to Top of Page
   

- Advertisement -