例如有一个表的值为
month value
---------------
1 6
2 10
3 9
我想获得的结果为
month value
-------------------
1 6
2 16
3 25
那么这个SQL应该怎么写呢
假设表名为table1
select a.month,sum(b.value)from table1 a,table1 b where a.month>=b.month
group by a.month
month value
---------------
1 6
2 10
3 9
我想获得的结果为
month value
-------------------
1 6
2 16
3 25
那么这个SQL应该怎么写呢
假设表名为table1
select a.month,sum(b.value)from table1 a,table1 b where a.month>=b.month
group by a.month