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@postgresql.org
Subject: Problems with complex queries ...
Date: Wed, 30 Aug 2000 00:46:18 +0200
Message-ID: <00083000494302.01170@txino.mikasa.eh> (raw)


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



view thread (3+ messages)  latest in thread

Message-ID: <00083000494302.01170@txino.mikasa.eh>
Permalink:  ../00083000494302.01170@txino.mikasa.eh/
Also on:    postgresql.org/message-id/00083000494302.01170@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: txinete@wanadoo.es
  Subject: Re: Problems with complex queries ...
  In-Reply-To: <00083000494302.01170@txino.mikasa.eh>
  References: <00083000494302.01170@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