Problems with complex queries ...

Поиск
Список
Период
Сортировка
От J. Fernando Moyano
Тема Problems with complex queries ...
Дата
Msg-id 00083000494302.01170@txino.mikasa.eh
обсуждение исходный текст
Ответы Re: Problems with complex queries ...
Re: Problems with complex queries ...
Список pgsql-sql
Hey everybody !!!
I am new on this list !!!

I have a little problem .....

I try this on my system: (Postgres 6.5.2, Linux)

"select n_lote from pedidos except select rp.n_lote from relpedidos rp,
relfacturas rf where  rp.n_lote=rf.n_lote group by rp.n_lote having
sum(rp.cantidad)=sum(rf.cantidad)"

and I get this result:

ERROR: rewrite: comparision of 2 aggregate
columns not supported 

but if I try this one:

"select rp.n_lote from relpedidos rp, relfacturas rf where 
rp.n_lote=rf.n_lote group by rp.n_lote having sum(rp.cantidad)=sum(rf.cantidad)"

It's OK !!

What's up???
Do you think i found a bug  ???
Do exists some limitation like this in subqueries??

(Perhaps Postgres don't accept using aggregates in subqueries ???)

I tried this too:

"select n_lote from pedidos where n_lote not in (select rp.n_lote from
relpedidos rp, relfacturas rf where  rp.n_lote=rf.n_lote group by rp.n_lote
having sum(rp.cantidad)=sum(rf.cantidad))"

but the result was the same !

And i get the same error message (or similar) when i try other variations.

Thanks !!!

Fer

--  ************* ******   ******  **********  *****   *****    ********************   ***** ******   **********
****** *****  ***********   *****         ********        ****     *************  ****    ****  *****           ****
     ****     ***** *******  ****    **** *****          *******        ****     *****  ******  ****    *********
****** *****   *********  *****   *****  ************
 
*****       ******   ****** *********  *****   *****    ******** 
(*) SymeX ==> http://www.lantik.com(*) Web en http://www.arrakis.es/~txino      (*) Informate sobre LINUX en
http://www.linux.org


В списке pgsql-sql по дате отправления:

Предыдущее
От: "stuart"
Дата:
Сообщение: Fw: Viewing a function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problems with complex queries ...