Re: caculating while select - maybe sum ?

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Ben-Nes Michael <miki(at)canaan(dot)co(dot)il>
Cc: Frank Bax <fbax(at)sympatico(dot)ca>, pgsql-general(at)postgresql(dot)org
Subject: Re: caculating while select - maybe sum ?
Date: 2002-02-05 17:26:04
Message-ID: 3C6015AC.6A692566@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2002-02-05 17:33:01 Re: [HACKERS] PostgreSQL v7.2 Final Release
Previous Message Thomas Lockhart 2002-02-05 17:23:12 Re: caculating while select - maybe sum ?