按30分钟统计:
select
to_timestamp(concat (to_char(created_at, 'yyyy-mm-dd HH24'), ':', FLOOR(date_part('minute', created_at) / 30)* 30), 'yyyy-mm-dd HH24:MI') as stat_at,
count(1)
from
cc_call_satisfaction
group by
stat_at
实例:
注:小于30分钟的按00统计,大于30分钟的按30统计
原始数据 | 查询结果 |
![]() | ![]() |