Re: Sum

Поиск
Список
Период
Сортировка
От Jean-Luc Lachance
Тема Re: Sum
Дата
Msg-id 3CA35F11.852DEADF@nsd.ca
обсуждение исходный текст
Ответ на Re: Sum  (Jim Martinez <jjm@bigbigorg.org>)
Список 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 по дате отправления:

Предыдущее
От: "Riebs, Andy"
Дата:
Сообщение: Re: Performance Tuning Document?
Следующее
От: Jean-Luc Lachance
Дата:
Сообщение: How to abort a pgaccess query?