# 每小时数量
SELECT create_time,HOUR(create_time) as Hour,count(1) as Count FROM table_name WHERE create_time between '2021-09-01 00:00:00' and now() GROUP BY HOUR(create_time) ORDER BY Hour(create_time);
# 每分钟数量
SELECT create_time,MINUTE(create_time) as MINUTE,count(1) as Count FROM table_name WHERE create_time between '2021-09-01 11:00:00' and '2021-09-01 12:00:00' GROUP BY MINUTE(create_time) ORDER BY MINUTE(create_time);
MySQL统计每小时、每分钟的数据
最新推荐文章于 2024-07-21 03:10:10 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)