mysql 获取规定时间段内的统计数据
按年统计
select count(*), date_format(order_info.create_time, '%y-%m-%d') as count_by_date from order_info where date_format(order_info.create_time, '%y') = '2017' group by count_by_date order by null
按月统计
select count(*), date_format(order_info.create_time, '%y-%m-%d') as count_by_date from order_info where date_format(order_info.create_time, '%y-%m') = '2017-04' group by count_by_date order by null
具体变换可以自己根据需求变更
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论