MySQL按日期分组统计(按天统计,按月统计)
按月统计(一)
select date_format(create_time, '%Y-%m') mont, count(*) coun from t_content group by date_format(create_time, '%Y-%m');
按天统计(二)
select date_format(create_time, '%Y-%m-%d') dat, count(*) coun from t_content group by date_format(create_time, '%Y-%m-%d');
按天统计(三)
select from_unixtime(create_time / 1000, '%Y-%m-%d') dat, count(*) coun from t_content group by from_unixtime(create_time / 1000, '%Y-%m-%d')
其他
格式转换
select from_unixtime(create_time / 1000, '%Y-%m-%d %H:%i:%S') create_time from t_content