Re: [SQL] having with sub select? - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] having with sub select?
Date
Msg-id 19712.945300835@sss.pgh.pa.us
Whole thread Raw
In response to having with sub select?  (<kaiq@realtyideas.com>)
List pgsql-sql
<kaiq@realtyideas.com> writes:
> select rep, sum(amount) 
> from orders 
> group by rep 
> having sum(amount) < (select quota from salesreps where empl_num = rep);
> for the query, I got (I'm using 6.5.1):
> ERROR:  Illegal use of aggregates or non-group column in HAVING clause

Seems to work OK in 6.5.3 and in current development sources ... I'm not
quite sure why it fails in 6.5.1 and not in 6.5.3, because I can't find
any indication that parse_aggs.c changed in between.  But please update
and see if you still have the problem.
        regards, tom lane


pgsql-sql by date:

Previous
From:
Date:
Subject: having with sub select?
Next
From:
Date:
Subject: Re: [SQL] having with sub select?