made this SQL postgres 8 proof

postgres 8 complains when you select fields that aren't in the GROUP BY
statement.