select DATE_FORMAT(date,'%Y%u') weeks,count(id) count from table group by weeks; select DATE_FORMAT(date,'%Y%m%d') days,count(id) count from table group by days; select DATE_FORMAT(date,'%Y%m') months,count(id) count from table group by months; 图解SQL的inner join、left join、right join、full outer join、union、union all的区别 https://yq.aliyun.com/articles/37377