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 |
avi_h
Starting Member
1 Post |
Posted - 2007-04-15 : 12:31:56
|
HiI have a table with complex key (userid,actionid,date)I need to get the latest action (by date)per user. get 1 row for each user + action filtered by the max date for the actionThanksAvi |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-15 : 14:05:27
|
[code]Select userid, actionidfrom Tbl t1where t1.date = (select max(date) from tbl t2 where t2.userid = t1.userid and t2.actionid = t1.actionid)[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|