gpt4 book ai didi

MySQL查询,其中一列行的结果与下一列相加

转载 作者:行者123 更新时间:2023-11-30 23:26:09 26 4
gpt4 key购买 nike

<分区>

我用过查询 这就像

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com