gpt4 book ai didi

mysql - 如何使用 MySQL 获取每天的数字总和?

转载 作者:行者123 更新时间:2023-11-29 06:35:54 24 4
gpt4 key购买 nike

我有一个表,如下所示:

用户:

id   points   date
1 100 2014-07-01
2 500 2014-07-02
3 200 2014-07-01
4 100 2014-07-03
5 100 2014-07-01
6 400 2014-07-02
7 800 2014-07-02
8 200 2014-07-02

现在,如何选择每个唯一的日期并计算这些天的积分总和?

所以我需要这样的结果:

points   date
400 2014-07-01
1900 2014-07-02
100 2014-07-03

最佳答案

SELECT   SUM(`points`) AS points, `date`
FROM users
GROUP BY `date`

关于mysql - 如何使用 MySQL 获取每天的数字总和?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24845109/

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