gpt4 book ai didi

mysql - Sum() MySQL - PHP

转载 作者:行者123 更新时间:2023-11-29 22:21:22 26 4
gpt4 key购买 nike

我想向 (ID = 37) 显示本月的总计

我的代码:

SELECT SUM(Total) 
FROM invoices
WHERE user_id = 37
And ModifiedTime BETWEEN DATE_SUB(CURDATE(),INTERVAL (DAY(CURDATE())-1) DAY)
AND LAST_DAY(NOW())

结果 = NULL

最佳答案

你可以试试这个:

SELECT SUM(Total) 
FROM invoices
WHERE user_id=37
And MONTH(ModifiedTime) = MONTH(now())

关于mysql - Sum() MySQL - PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30680740/

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