mysql字段如下 id bigint ,place varchar,in int,year int, month int ,day int,hour int ,minute int created_at timestamp 。mysql查询24小时内进站人数统计sql 按小时分组
时间: 2023-05-30 20:06:32 浏览: 100
sqlserver/mysql按天、按小时、按分钟统计连续时间段数据【推荐】
4星 · 用户满意度95%
SELECT HOUR(created_at) as hour, COUNT(in) as count FROM 表名 WHERE created_at BETWEEN DATE_SUB(NOW(), INTERVAL 24 HOUR) AND NOW() GROUP BY HOUR(created_at);
阅读全文