Re: caculating while select - maybe sum ? - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: caculating while select - maybe sum ?
Date
Msg-id 3C6015AC.6A692566@fourpalms.org
Whole thread Raw
In response to Re: caculating while select - maybe sum ?  (Frank Bax <fbax@sympatico.ca>)
List pgsql-general
... and if you want to ditch the function call, you can try something
like this:

lockhart=# select *, (select sum(e-b) from t1 where b <= x.b) from t1 x;
 i |           b            |           e            | ?column?
---+------------------------+------------------------+----------
 1 | 2002-02-05 17:14:37+00 | 2002-02-05 17:14:38+00 | 00:00:01
 1 | 2002-02-05 17:14:40+00 | 2002-02-05 17:14:41+00 | 00:00:02
 1 | 2002-02-05 17:14:41+00 | 2002-02-05 17:14:42+00 | 00:00:03
 1 | 2002-02-05 17:14:42+00 | 2002-02-05 17:14:43+00 | 00:00:04
(4 rows)

pgsql-general by date:

Previous
From: teg@redhat.com (Trond Eivind Glomsrød)
Date:
Subject: Re: [HACKERS] PostgreSQL v7.2 Final Release
Next
From: Vivek Khera
Date:
Subject: Re: Indices for foreign keys