SQL92 requires that all columns (except aggregates) in the select clause
is part of the group by clause. SQL99 loosens this restriction a bit and
states that all columns in the select clause must be functionally
dependent of the group by clause.
This commit fixes all partial GROUP BY queries to be compatible with
SQL92. Previously, when MySQLs sql_mode included ONLY_FULL_GROUP_BY,
aggregating queries failed, resulting in an empty domain listing.