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.
我正在使用从 MySQL 数据库中选择当天午夜和现在之间的所有时间戳time()。如何按小时对所有时间戳进行分组,然后返回一个包含所有 24 个数组的计数的数组?例如,最后它应该返回如下内容:
time()
Array(0 => 60, 1 => 104, 2 => 280, ..., 23 => 50)
SELECT *, CEIL(tstamp/3600)*3600 AS byhour FROM table WHERE <your where goes here> ORDER BY byhour