mysql 按每月自定天数统计数据
程序员文章站
2024-03-25 14:00:40
...
表结构
查询一个月内每五天的总数
SELECT
COUNT(wc.`id`) AS countNumber,wc.`createdDate`
FROM
wechatuser wc
WHERE DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= DATE(wc.`createdDate`) GROUP BY (
YEAR(wc.`createdDate`)* 1000 + (DAYOFYEAR(wc.`createdDate`)-MOD(DAYOFYEAR(CURDATE()),5)) DIV 5
);
上一篇: MAC下linux双系统的安装
下一篇: Docker教程-安装