MySQL按日期分组统计(按天统计,按月统计)
以下为您演示MySQL常用的日期分组统计方法:
按月统计(一)
select date_format(create_time, '%Y-%m') mont, count(*) coun from t_content group by date_format(create_time, '%Y-%m');
按天统计(二)
SELECT date_format(created_at, '%Y-%m-%d') dat,count(*) count FROM `fook_coupon_syn` WHERE operation = 'OrderCode' group by date_format(created_at, '%Y-%m-%d');
链接:https://blog.csdn.net/lpw_cn/article/details/89487801