select DATE_FORMAT(order_date,'%Y%m') months,count(order_no) count from so_order group by months;
select DATE_FORMAT(order_date,'%Y%u') weeks,count(order_no) count from test group by weeks;
- 按月统计
- 按周统计
- 按天统计
select DATE_FORMAT(order_date,'%Y%m%d') days,count(order_no) count from test group by days;