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 clauseLINE 1: select id from pref_match where sum(completed) > 30 group by... ^