fix SQL syntax Error of GROUP BY after ORDER BY (mysql 5.6.13)