Re: Sum - Mailing list pgsql-general

From Jim Martinez
Subject Re: Sum
Date
Msg-id Pine.LNX.4.33.0203281238470.9015-100000@unagi.e-techservices.com
Whole thread Raw
In response to Re: Sum  (Jean-Luc Lachance <jllachan@nsd.ca>)
List pgsql-general
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: Marcelo Pereira
Date:
Subject: Re: Sum
Next
From: Andrew Sullivan
Date:
Subject: Re: table design strategy