Create a gist now

Instantly share code, notes, and snippets.

-- pg 9.2 (should also work with 9.1)
tanga_dev=# select users.id, users.username from users inner join points on points.user_id = users.id group by users.id;
id | username
----+-----------------
6 | active_user
4 | normal
-- pg 9.0
tanga_dev=# select users.id, users.username from users inner join points on points.user_id = users.id group by users.id;
ERROR: column "users.username" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select users.id, users.username from users inner join points...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment