mysql里有没有好的方法查询一天中每小时的数据?
我可不想不停的去修改时间参数。
正好我这两天做过.
[code="sql"]
select hour(dateTime) as hour, count(1) as count
from tableName
where DATE_FORMAT(dateTime,'%Y-%m-%d') = '2001-01-01'
group by hour(dateTime);
[/code]
没有环境可以测试, 不过大概思路没错, 你看下能不能用, 有报错的话我再看看.