确定要统计的时间字段,例句中为start_time
1. 从表TABLE_NAME中以字段START_TIME为参照,按天统计
select START_TIME, DATE_FORMAT(START_TIME,'%Y-%m-%d') as day, count(*) as sum from TABLE_NAME group by day;
2. 从表TABLE_NAME中以字段START_TIME为参照,按月统计
select START_TIME, DATE_FORMAT(START_TIME,'%Y-%m') as month, count(*) as sum from TABLE_NAME group by month;
3. 统计表TABLE_NAME中以字段START_TIME为参照,共多少天数据,多少条数据
select to_days(now()) - to_days(min(START_TIME)) as days, count(*) from TABLE_NAME;