Reputation: 40140
I have a table with columns user_id
, time_stamp
and activity
which I use for recoding user actions for an audit trail.
Now, I would just like to get the most recent timestamp for each unique user_id
. How do I do that?
Upvotes: 3
Views: 1737
Reputation: 3171
The following query should be what you want...
select user_id,max(time_stamp) from yourtable group by user_id order by user_id, time_stamp desc
Upvotes: 3