Oracle以15分钟为界,统计一天内各时间段的数据笔数

db.table替换为自己的表名,StartTime为date字段

select count(*),
(case floor((to_char(StartTime,'mi'))/15)
when 0 then to_char(StartTime,'yyyy.mm.dd hh')||':00:00'
when 1 then to_char(StartTime,'yyyy.mm.dd hh')||':15:00'
when 2 then to_char(StartTime,'yyyy.mm.dd hh')||':30:00'
when 3 then to_char(StartTime,'yyyy.mm.dd hh')||':45:00'
end) as StartTime
from db.table
group by StartTime

上一篇:APK安装时的过滤方式:包名白名单、证书认证


下一篇:Revit二次钢筋