Mysql按日、周、月进行分组统计
作者:互联网
1)按天统计: select DATE_FORMAT(start_time,'%Y%m%d') days,count(product_no) count from test group by days;
2)按周统计: select DATE_FORMAT(start_time,'%Y%u') weeks,count(product_no) count from test group by weeks;
3)按月统计: select DATE_FORMAT(start_time,'%Y%m') months,count(product_no) count from test group bymonths;
标签:count,group,FORMAT,no,分组,Mysql,DATE,按日,select 来源: https://www.cnblogs.com/wj123bk/p/16627324.html