pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Stanaway <david@netventures.com.au>
To: pgsql-sql@postgresql.org
Subject: cumulative sum in aggregate query.
Date: Wed, 11 Jul 2001 15:30:29 +1000
Message-ID: <E15KD3X-0004lz-00@runt.in.netventures.com.au> (raw)

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@NetVentures.com.au     Office +612 9357 1699
========================'---------------------------------------------



view thread (2+ messages)  latest in thread

Message-ID: <E15KD3X-0004lz-00@runt.in.netventures.com.au>
Permalink:  ../E15KD3X-0004lz-00@runt.in.netventures.com.au/
Also on:    postgresql.org/message-id/E15KD3X-0004lz-00@runt.in.netventures.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: david@netventures.com.au
  Subject: Re: cumulative sum in aggregate query.
  In-Reply-To: <E15KD3X-0004lz-00@runt.in.netventures.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox