Another solution mentioned multiple times above is to turn off that annoying 'ONLY_FULL_GROUP_BY' e.g. like in this post: Disable ONLY_FULL_GROUP_BY
I think this solution is very useful if you do not want to refactor the whole project for multiple hours. And if you do not care about the unpredictable values of the columns which are not list of the GROUP BY.