I have a table
ID OpeningBal Type
1 1000 -
2 100 IN
3 200 OUT
4 100 OUT
5 300 IN
I want Output in sql query without lag function like this
ID OpeningBal Type Closing Bal
1 1000 - 0
2 100 IN 1100
3 200 OUT 900
4 100 OUT 800
5 300 IN 1100