cumulative sum in aggregate query.

From: David Stanaway <david(at)netventures(dot)com(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: cumulative sum in aggregate query.
Date: 2001-07-11 05:30:29
Message-ID: E15KD3X-0004lz-00@runt.in.netventures.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi there,

I have a query that gives me x/y data for a graph, and at the moment,
the y data is relative.

EG:

x | y
1.2 | +1
1.9 | 0
3.4 | +4
5.2 | -2
6.7 | -1
9.3 | 0
11.3 | -1

Now, I want to convert this result into a result like this:
x | y
1.2 | 1
1.9 | 1
3.4 | 5
5.2 | 3
6.7 | 2
9.3 | 0
11.3 | 1

Does anyone have any suggestions as to how to do this?

--
Best Regards
David Stanaway
========================.---------------------------------------------
Technology Manager - Australia's Premier Internet Broadcasters
david(at)NetVentures(dot)com(dot)au Office +612 9357 1699
========================'---------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Carlos 2001-07-11 08:41:41 Select distinct and order by.
Previous Message Mathew White 2001-07-11 04:39:01 Re: SQL - histogram