I need to get the sum of next 5 rows that are order by one specific column
: in sqlite
actual table
YEAR TOT
2001 1
2002 2
2003 3
20010 10
20011 11
20012 12
20013 13
20014 14
20015 15
Now Expected Results : YEAR TOT Exp_res
2001 1 1+2+3+4+5 = 15
2002 2 2+3+4+5+6 = 20
2003 3 3+4+5+6+7 = 25
20010 10 10+11+12+13+14
20011 11 11+12+13+14+15
20012 12 12+13+14+15
20013 13 13+14+15
20014 14 14+15
20015 15 15
No comments:
Post a Comment