caculating while select - maybe sum ?

From: "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il>
To: <pgsql-general(at)postgresql(dot)org>
Subject: caculating while select - maybe sum ?
Date: 2002-02-05 14:17:25
Message-ID: 00d801c1ae4f$d623bbc0$aa0f5ac2@canaan.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All

im trying to calculate hour usage so a typical row is: 1. enter time, 2.
exit time 3. sum() until this row

Couldn't use sum() as it ask me to 'group by' which I don't want.

Is there a way to add the previous row value to the current, per row ?

example:
select row1, row2, (row1 + row2 until now) from table;

--------------------------
Canaan Surfing Ltd.
Internet Service Providers
Ben-Nes Michael - Manager
Tel: 972-4-6991122
http://sites.canaan.co.il
--------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-02-05 15:44:21 Re: Getting fields in a table through a query?
Previous Message Jan Wieck 2002-02-05 13:55:10 Re: rule on update