I need to sum the previous rows in sql 2005. This my table
id date valuein valueout misstotal
5 2/2/2013 0 500 -500
2 25/2/2013 0 300 -300
7 25/2/2013 900 0 900
4 25/2/2013 2000 0 2000
misstotal = ( valuein - valueout)
This is not the problem
I want a column to have the total balance like below table in the total
column.
id date valuein valueout misstotal total
5 2/2/2013 0 500 -500 -500
2 25/2/2013 0 300 -300 -800
7 25/2/2013 900 0 900 100
4 25/2/2013 2000 0 2000 2100
So whats the code for doing this sum?