And same for a simple select-query from1 table (w/o join): # select id from pref_match where sum(completed) > 30 group by id; ERROR: aggregates not allowed in WHERE clause LINE 1: select id from pref_match where sum(completed) > 30 group by... ^ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general