按日統計
select DATE_FORMAT(date,’%Y%m%d’) days,count(id) count from table group by days;
按周統計
select DATE_FORMAT(date,’%Y%u’) weeks,count(id) count from table group by weeks
按月統計
select DATE_FORMAT(date,’%Y%m’) months,count(id) count from table group by months;
按年統計
select DATE_FORMAT(date,’%Y’) years ,count(id) count from table group by years;;