SELECT HOUR(e.time) as Hour,count(*) as Count
FROM error_log e
WHERE e.date = '2017-09-02'
GROUP BY HOUR(e.time) ORDER BY Hour(e.time);
下面是查询结果截图
在另一篇文章里,我总结了查询每半小时统计一次的方法。Mysql 查询一天中每半小时记录的数量
SELECT HOUR(e.time) as Hour,count(*) as Count
FROM error_log e
WHERE e.date = '2017-09-02'
GROUP BY HOUR(e.time) ORDER BY Hour(e.time);
下面是查询结果截图
在另一篇文章里,我总结了查询每半小时统计一次的方法。Mysql 查询一天中每半小时记录的数量