テーブルには次のようなデータがあります
<--------------------------->
no category value
<--------------------------->
1 1 2000
2 1 1000
3 2 500
4 3 3000
5 1 2000
6 2 -500
7 3 5000
8 1 -1000
そして、私は次のような出力が欲しい
<---------------------------------->
no category amount Sum
<---------------------------------->
1 1 2000 2000
2 1 1000 3000
3 2 500 500
4 3 3000 3000
5 1 2000 5000
6 2 -500 0
7 3 5000 8000
8 1 -1000 4000
例:category=1
そうしてください、
no:1
amount=2000--->total=2000
no:2
amount=1000---->total=3000
no:5
amount=2000---->total=5000
no:8
amount=-1000---->total=4000
これは、すべての行の各カテゴリの合計であり、パフォーマンスが向上していることを意味します