Received: from smtp2.alehop.com ([62.81.160.68]) by hub.org (8.10.1/8.10.1) with ESMTP id e7RNt4L22004 for ; Sun, 27 Aug 2000 19:55:04 -0400 (EDT) Received: from txino.mikasa.eh ([62.82.73.76]) by smtp2.alehop.com (Netscape Messaging Server 4.15) with SMTP id FZZ6FS01.8F1 for ; Mon, 28 Aug 2000 01:55:04 +0200 From: "J. Fernando Moyano" Organization: SymeX To: pgsql-sql@hub.org Subject: Complex query Date: Mon, 28 Aug 2000 01:42:03 +0200 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain MIME-Version: 1.0 Message-Id: <00082801521705.00923@txino.mikasa.eh> Content-Transfer-Encoding: 8bit X-Archive-Number: 200008/292 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