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

`GROUP BY` clause should before `ORDER BY` clause in mysql v5.6, or mysql will throw Error: 

ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY gameid LIMIT 18446744073709551610' at line 1