2017年4月9日 星期日

MySql按週、月、年進行統計記

晚上8:33 Posted by 有為青年 No comments

select DATE_FORMAT(create_time,'%Y%u') weeks,count(caseid) count from tc_case group by weeks;  
select DATE_FORMAT(create_time,'%Y%m%d') days,count(caseid) count from tc_case group by days;  
select DATE_FORMAT(create_time,'%Y%m') months,count(caseid) count from tc_case group by months;