我使用了一个类似的查询
SELECT app_id, SUM(amount), date
FROM abc
GROUP BY app_id,date
结果显示如下
1 10 1-2-2000
2 20 1-2-2000
3 30 1-2-2000
1 20 2-2-2000
2 40 2-2-2000
3 50 2-2-2000
我想通过新列获得所需的结果
1 10 1-2-2000
2 30 1-2-2000 # sum of amount of app_id=1 and app_id=2
3 60 1-2-2000 # sum of amount of app_id=1 and app_id=2 and app_id=3
1 20 2-2-2000
2 60 2-2-2000 # sum of amount of app_id=1 and app_id=2
3 110 2-2-2000 # sum of amount of app_id=1 and app_id=2 and app_id=3