[ticket/12712] Remove unneeded GROUP BY clause to fix query for mssql

PHPBB3-12712