我有一张表格,记录了一些地点的一些访问信息以及时间,也许还有一些关于这个地方的评论,比如:
+---------+---------+------------+-----------------------+---------------------+
| visitId | userId | locationId | comments | time |
+---------+---------+------------+-----------------------+---------------------+
| 1 | 3 | 12 | It's a good day here! | 2012-12-12 20:50:12 |
+---------+---------+------------+-----------------------+---------------------+
我想做的是按小时计算访问组的数量,我想这样生成结果:
+------------+-----+-----+-----+-----+-----+-----+-------+------+
| locationId | 0 | 1 | 2 | 3 | 4 | 5 | ... | 23 |
+------------+-----+-----+-----+-----+-----+-----+-------+------+
| 12 | 15 | 12 | 34 | 67 | 78 | 89 | ... | 34 |
+------------+-----+-----+-----+-----+-----+-----+-------+------+
我怎样才能做到这一点?我想评估一整天的访问量差异。