SQL - GROUP BY

GROUP BY with max in subgroups