I have a result set from a SQL Server query as below:
Item Week Amount
1 1 500
1 2 -100
1 3 -200
2 1 800
2 2 -600
2 3 -800
What I want to know is, is it possible to derive a fourth column that gives a running total of amount for each item?
My desired result is as follows:
Item Week Amount Total
1 1 500 500
1 2 -100 400
1 3 -200 200
2 1 800 800
2 2 -600 200
2 3 -800 -600
I am using SQL Server 2008