表test
id store
1 33
2 55
3 66
4 88
5 12
查詢或的結果
id store store1 store2
1 33 33 33
2 55 88 121
3 66 154 275
4 88 242 517
5 12 254 771
求SQL語句
select id,store,store1,(select SUM(store1) from (select id,store,(select SUM(store) from t_test b where b.ID<=a.ID ) store1 from t_test a) copyt where copyt.ID<=thist.ID) store2 from (select id,store,(select SUM(store) from t_test b where b.ID<=a.ID ) store1 from t_test a) thist