Re: Sum - Mailing list pgsql-general

From Jean-Luc Lachance
Subject Re: Sum
Date
Msg-id 3CA35F11.852DEADF@nsd.ca
Whole thread Raw
In response to Re: Sum  (Jim Martinez <jjm@bigbigorg.org>)
List pgsql-general
Maybe our resident expert on SQL standard, Tom Lane, would care to
answer this one.


Jim Martinez wrote:
>
> After much thought on Mar 28  Jean-Luc Lachance wrote:
>
> > Marcelo,
> >
> > Assuming that "cod" is unique and sequencial, you can use the following:
> >
> > SELECT *, ( SELECT SUM( value) from table as t2 where t2.cod <= t1.cod)
> > as running_total
> > FROM table as t1
> > ORDER BY cod;
> >
> > jll
> >
>
> Subqueries outside of the where clause are great!  I hadn't come accross
> them when working with the more well advertised database products.
>
> Are they SQL9x compliant?  I try to develop using non postgres specific
> tools when I can.
>
> Jim

pgsql-general by date:

Previous
From: "Riebs, Andy"
Date:
Subject: Re: Performance Tuning Document?
Next
From: Jean-Luc Lachance
Date:
Subject: How to abort a pgaccess query?