Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
technical
Starting Member
1 Post |
Posted - 2009-05-30 : 08:36:48
|
Hi friends...I need to find the cumulative total(running total) of a column. i.e. the sum of the field x.Field1 as a seperate column.NB. The inner Table is set of subqueries.select x.Field1 from ( select T.Field1,T.Field2 from Table1 T)xThe result should be like...Field1 Cumulative Sum-----------------------------------1 12 33 64 10 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-05-30 : 08:45:48
|
Where do you want to show data?If you use front end application, do running total thereOtherwise search for Running total+SQL Server in googleMadhivananFailing to plan is Planning to fail |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-05-30 : 08:46:05
|
Is Field1 always without gaps? No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-30 : 14:00:17
|
[code]SELECT Field1,(SELECT SUM(Field1) FROM Table WHERE Field1<=t.Field1) AS CumulativeSumFROM Table t[/code] |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|