Re: aggregate function ? - Mailing list pgsql-novice

From Richard Broersma Jr
Subject Re: aggregate function ?
Date
Msg-id 833051.59952.qm@web31806.mail.mud.yahoo.com
Whole thread Raw
In response to Re: aggregate function ?  (Raimon Fernandez <coder@montx.com>)
Responses Re: aggregate function ?  (Raimon Fernandez <coder@montx.com>)
List pgsql-novice
--- Raimon Fernandez <coder@montx.com> wrote:

> but If I send the code that you send me, it takes too much .... well,
> more than 20 minutes and still waiting ...

just for testing try this version again so see if it preforms much better, then see if the summing
results are correct according to what you need.

    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
     WHERE A1.numero=11189
  GROUP BY A1.oid, A1.concepte, A1.deure, A1.haver
  ORDER BY A1.oid;

pgsql-novice by date:

Previous
From: Raimon Fernandez
Date:
Subject: Re: aggregate function ?
Next
From: Raimon Fernandez
Date:
Subject: Re: aggregate function ?