Running Total with a Set Maximum

From: "Paul Newman" <pnewman(at)prohire(dot)co(dot)uk>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Running Total with a Set Maximum
Date: 2010-09-01 10:20:30
Message-ID: 2796D8B40BBACF42965C54F9AE6969B30180AF@sbs2003.prohire.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Could someone out there help me.
Given the following set of values
+3
+3
0
+3
+3
-3
0
+3

I want to have a maximum sum of 6 at any one point , in other words I want the following


+3 -- 3
+3 -- 6
0 -- 6
+3 -- 6
+3 -- 6
-3 -- 3
0 -- 3
+3 -- 6

How can I do this ?

Thank you

Paul Newman

Disclaimer
This message may contain information which is legally privileged and/or confidential.
If you are not the intended recipient, you are hereby notified that any unauthorised disclosure, copying, distribution or use of this information is strictly prohibited.
Such notification not withstanding, any comments or opinions expressed are those of the originator, not of Tripoint Ltd, unless otherwise explicitly stated.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Luka Novak 2010-09-01 10:35:13 postgreSQL problem
Previous Message Adarsh Sharma 2010-09-01 10:13:21 Problem in getting Output