~jk groupwise max
http://jan.kneschke.de/projects/mysql/groupwise-max
One of the common problems to solve in SQL is “Get row with the group-wise maximum”. Getting just the maximum for the group is simple, getting the full row which is belonging to the maximum is the interesting step.