pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: J. Fernando Moyano <txinete@wanadoo.es>
To: pgsql-sql@hub.org
Subject: Complex query
Date: Mon, 28 Aug 2000 01:42:03 +0200
Message-ID: <00082801521705.00923@txino.mikasa.eh> (raw)



Hey everybody !!!
I am new on this list !!!

I have a little problem .....

I try this on my system:

"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)"

I get this result:
 
ERROR: rewrite: comparision of 2 aggregate
columns not supported 

but if a 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 exist 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



view thread (8+ messages)  latest in thread

Message-ID: <00082801521705.00923@txino.mikasa.eh>
Permalink:  ../00082801521705.00923@txino.mikasa.eh/
Also on:    postgresql.org/message-id/00082801521705.00923@txino.mikasa.eh

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: txinete@wanadoo.es, pgsql-sql@hub.org
  Subject: Re: Complex query
  In-Reply-To: <00082801521705.00923@txino.mikasa.eh>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox