Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试显示我的网站在一天中的每个小时内获得了多少用户。我想出了这个,它有效,但是......
$time = mysql_query("SELECT * FROM track_log WHERE time>='{$date} 00:00:00' AND time<='{$date} 01:00:00'"); $hour = mysql_num_rows($time);
在我再做 23 次之前,有没有更好的方法来获得每小时的结果?
SELECT hour(`time`) as hour_of_day, count(*) FROM track_log group by hour_of_day