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.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Cumulative Sum Update

Author  Topic 

mkdlmr
Starting Member

21 Posts

Posted - 2013-12-18 : 21:15:10
How can I update a table to have a running cumulative sum?

For Example:

Update Table1 Set Cumulative_Sum = Row_Sum + Previous_Row_Sum

It should look something like this:

Row_Sum Cumulative_Sum
1 1
2 3
3 6
4 10

Thanks,
Mark

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-12-18 : 21:48:47
duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=190396

Please do not cross post


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -