Skip site navigation (1) Skip section navigation (2)

Re: aggregate function ?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Raimon Fernandez <coder(at)montx(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: aggregate function ?
Date: 2007-05-16 14:06:49
Message-ID: 164249.35270.qm@web31812.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-novice
--- Raimon Fernandez <coder(at)montx(dot)com> wrote:
> but maybe is a silly question, but I'm a really novice, i thought  
> this should be really-really faster ... near 50 seconds is too much ...
> 

Do worry,  we are gett closer to a working query.  Each round trip is providing more details that
will help us to craft a better query:

    SELECT A1.oid, A1.concepte, A1.deure, A1.haver,
           sum( COALESCE( A1.deure, 0 ) - 
                COALESCE( A2.haver, 0 )) AS value_sum
      FROM Assentaments AS A1
INNER JOIN Assentaments AS A2
        ON A1.oid <= A2.oid
       AND A1.numero = A2.numero  --this should only preform a sum on a specify numero
     WHERE A1.numero=11189
  GROUP BY A1.oid, A1.concepte, A1.deure, A1.haver
  ORDER BY A1.oid;



In response to

Responses

pgsql-novice by date

Next:From: Raimon FernandezDate: 2007-05-16 14:31:38
Subject: Re: aggregate function ?
Previous:From: Raimon FernandezDate: 2007-05-16 13:34:57
Subject: Re: aggregate function ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group