Re: [SQL] having with sub select?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: kaiq(at)realtyideas(dot)com
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] having with sub select?
Date: 1999-12-15 23:33:55
Message-ID: 19712.945300835@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<kaiq(at)realtyideas(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message kaiq 1999-12-15 23:47:31 having with sub select?
Previous Message brent wood 1999-12-15 17:39:00 Re: [GENERAL] Access rescrictions