mysql 获取规定时间段内的统计数据
程序员文章站
2022-08-29 23:09:58
mysql 获取规定时间段内的统计数据
按年统计
select
count(*),
date_format(order_info.creat...
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
具体变换可以自己根据需求变更
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
上一篇: Go语言实现的web爬虫实例