public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12
-- 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...

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.