Hi Expert,
Thanks for your help
I have checked some topic for this and they are suggest using Row-1,-2 to calcualte this
But my data structure is like this
Customer YearMonth GSV
A 201201 100
A 201203 50
B 201301 400
A 201209 1000
I need to have a new colum as rolling 12 month GSV
But as you could see for customer A, it is NOT always has slaes for each month
So I need to use a loop like
SELECT * from table where customer = current_row customer and yearmonth >= current month - 12 and yearmonth <current month
Customer YearMonth GSV Rolling_12
A 201201 100 0
A 201203 50 100
B 201301 400 0
A 201209 1000 150
Please kindly let me know how to achieve this
Best regards
Alex yang