Skip to content

Instantly share code, notes, and snippets.

@joevandyk
Created November 30, 2011 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joevandyk/1407737 to your computer and use it in GitHub Desktop.
Save joevandyk/1407737 to your computer and use it in GitHub Desktop.
-- 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