Re: [SQL] having with sub select?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] having with sub select?
Дата
Msg-id 19712.945300835@sss.pgh.pa.us
обсуждение исходный текст
Ответ на having with sub select?  (<kaiq@realtyideas.com>)
Список 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 по дате отправления:

Предыдущее
От:
Дата:
Сообщение: having with sub select?
Следующее
От:
Дата:
Сообщение: Re: [SQL] having with sub select?