Question: 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?

Answer: 
`SELECT MAX(time_stamp), user_id FROM table GROUP BY user_id;`
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 

```