我正在尝试每天点击次数。查询根据需要进行计数,但是我的日子不合适。我该如何解决这个问题?
未转换的hittime是时间戳 - 2016-06-16 06:57:14
以下是查询:
select to_char(hittime, 'YYYY-MM-DD'),
count(hitid)
from hits
group by to_char(hittime, 'YYYY-MM-DD');
示例输出:
to_char | count
------------+-------
2016-05-04 | 92
2016-05-05 | 120
2016-05-07 | 2
2016-05-08 | 2
2016-05-11 | 139
2016-05-13 | 54
2016-05-17 | 96
2016-05-18 | 23
2016-05-26 | 53
2016-05-28 | 1
2016-05-30 | 31
2016-06-04 | 9
2016-06-05 | 37
2016-06-06 | 173
2016-06-09 | 364
2016-06-13 | 446
2016-06-14 | 533
2016-06-16 | 10
2016-05-06 | 153
2016-05-09 | 297
2016-05-10 | 90
2016-05-12 | 88
2016-05-16 | 66
2016-05-19 | 123
2016-05-20 | 34