Fix SQL GROUP BY 2