Group by fix

You need to specify all non agggregate columns in a GROUP by otherwise you get errors on Postgres (and probably other databases too!)