I already have a running total column in my SQL Server table like below
ID Value
1 1000
2 2000
3 3000
4 4000
5 5000
I need to get the incremental sum( not sure whether it's the right word for it) of the values, for eg: 1000 + (1000-2000) + (2000-3000) + (3000-4000) + (4000-5000) = 5000
the end result should be like this so that I can get the sum of INC_Sum column
ID Value INC_Sum
1 1000 1000
2 2000 1000
3 3000 1000
4 4000 1000
5 5000 1000
the one that I've given above is an example and my table has got much more complex values in millions. I'm running SQL server 2008 R2, Can someone help me with this?