我有一个有 2 个字段的表,如下所示:
Day_col | Value_col
2013-06-06 1
2013-06-05 2
2013-06-04 3
2013-06-03 4
2013-06-02 5
我想创建一个 sql (sum(Value_col) of 3 days after - if have 3 days or more will be sum, if less 3 days don't sum),然后收到这样的结果:
Day_col | total
2013-06-06 9 <- total after '2013-06-06' 3 days are 5,4,3 is 9
2013-06-05 12 <- total after '2013-06-05' 3 days are 4,3,2 is 12
2013-06-04 -- <- total after '2013-06-04' 2 days don't sum
2013-06-03 -- <- total after '2013-06-03' 1 days don't sum
2013-06-02 -- <- total after '2013-06-02' 0 days don't sum
请帮忙