On Mar 16, 2011, at 3:15 AM, Alexander Farber wrote: > 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... > ^ Use having clause for aggrgate function, group by col1, col2 having sum(col) > Thanks & Regards, Vibhor Kumar EnterpriseDB Corporation The Enterprise PostgreSQL Company vibhor.kumar@xxxxxxxxxxxxxxxx Blog:http://vibhork.blogspot.com -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general