Re: Sum

Поиск
Список
Период
Сортировка
От Jim Martinez
Тема Re: Sum
Дата
Msg-id Pine.LNX.4.33.0203281238470.9015-100000@unagi.e-techservices.com
обсуждение исходный текст
Ответ на Re: Sum  (Jean-Luc Lachance <jllachan@nsd.ca>)
Список 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 по дате отправления:

Предыдущее
От: Marcelo Pereira
Дата:
Сообщение: Re: Sum
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: table design strategy