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.
| 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:tbl1Modify_date_time-----------UserID----LoginID2004-06-07 10:23:38.000---1000------80012005-04-06 10:23:38.000---1000------80502006-08-19 08:53:01.000---1000------8080I 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.loginIDfrom tbl1 aorder by modify_date_time desc[/code]Hopefully you have an index on modify_date_time. |
 |
|
|
ladiaocb
Yak Posting Veteran
57 Posts |
Posted - 2006-05-01 : 12:43:59
|
| I do and this works perfect thanks! |
 |
|
|
|
|
|