Reputation: 113
Result table
my expectation query
help me please, how to get data sum_of_previous from total_point like that
I am using lag() but that only get last 1 previous field i need all previous every row running and sum that
Upvotes: 0
Views: 88
Reputation: 93694
Use SUM() Over()
window aggregate function instead of LAG
. LAG
can used to find the only one previous row in ordered set
Select id,
total_point,
sum(total_point)over(order by Id)
From yourtable
Upvotes: 2