Home » SQL & PL/SQL » SQL & PL/SQL » Sum recursively values inside same column
Sum recursively values inside same column [message #309117] Wed, 26 March 2008 08:23 Go to next message
ZeljkoV
Messages: 3
Registered: March 2008
Junior Member
I trouble myself two days with problem on which I think someone could have easy solution.
Problem is:

I have a table with column in which are already summary numbers;

MM/YYYY | NUMB
01/08 | 12
02/08 | 3
03/08 | 10

I need to add one more column at it, which would look like

MM/YYYY | NUMB | SUM |
01/08 | 12 | 12 |
02/08 | 3 | 15 |
03/08 | 10 | 25 |

Values in sum is result of numbers, one after another from NUMB column;
0 + 12 = 12
12 + 3 = 15
15 + 10 = 25

I tried combinations with lead and lag functions, but couldn't managed to get values in sum column as wanted

Please, if someone know solution...
Re: Sum recursively values inside same column [message #309118 is a reply to message #309117] Wed, 26 March 2008 08:26 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SUM in its analytic form.

Regards
Michel
Re: Sum recursively values inside same column [message #309127 is a reply to message #309118] Wed, 26 March 2008 08:51 Go to previous message
ZeljkoV
Messages: 3
Registered: March 2008
Junior Member
Thanks, link was very helpfull..
Previous Topic: INFO REQ on string manipulation
Next Topic: Using CASE in WHERE Clause
Goto Forum:
  


Current Time: Thu Dec 08 02:19:24 CST 2016

Total time taken to generate the page: 0.19242 seconds