little query question, I have table:
id | user_id | paper_update
------------------------------
1 | 1 | 30-5-2011
2 | 2 | 30-5-2012
3 | 3 | 30-5-2012
4 | 1 | 30-5-2013
5 | 2 | 30-5-2013
6 | 3 | 30-5-2014
7 | 4 | 30-5-2014
8 | 5 | 30-5-2014
9 | 5 | 30-5-2015
10 | 5 | 30-5-2016
11 | 1 | 30-5-2010
-------------------------------
What I'm looking to do is to select only the records where paper_update
is max between records with the same user_id
, actually I want to group by the user_id
in order to the max paper_update
.
so for this table it will return this:
id | user_id | paper_update
------------------------------
4 | 1 | 30-5-2013
5 | 2 | 30-5-2013
6 | 3 | 30-5-2014
7 | 4 | 30-5-2014
10 | 5 | 30-5-2016
-------------------------------