解决oracle里用一个语句实现固定时间间隔的记录数统计,比如我想统计某表时间类型的A字段每隔3天的记录数,2007-8-1到2007-8-3,2007-8-4到2007-8-6....各自范围内的记录数
SELECT COUNT (1)
FROM (SELECT FLOOR ((t.infection_takendate - :a) / 3) as col, t.*
FROM infection_list t where t.infection_takendate between :a and :b) t1
GROUP BY col
那两个时间分别替换参数a、b,即可实现