I have below given table
ID Value
1 10
2 20
3 40
I want below output
ID Value Total
1 10 10
2 20 30
3 40 70
I want to calculate total by adding value in each column by adding total column in result.
I have below given table
ID Value
1 10
2 20
3 40
I want below output
ID Value Total
1 10 10
2 20 30
3 40 70
I want to calculate total by adding value in each column by adding total column in result.
SELECT
id
, value
, SUM(value) OVER (ORDER BY ID ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS Total
FROM YourTable