如何递增求和?TBNum1123456如何求出下面的NUM2,1=1,3=1+2,6=1+2+3,10=1+2+3+4,15=1+2+3+4+5,21=。。。。。。Num1Num2112336410515621[解决办法]
--把上边的id修改为num1,tab改为num1select num1,(select sum(num1)from tb where num1<=t.num1) as a from tb as t