--按六小时分组
select trunc(to_number(to_char(created_time, 'hh24')) / 6),count(*)
from t_test
where created_time > trunc(sysdate - 40)
group by trunc(to_number(to_char(created_time, 'hh24')) / 6)
--按12小时分组
select trunc(to_number(to_char(created_time, 'hh24')) / 6),count(*)
from t_test
where created_time > trunc(sysdate - 40)
group by trunc(to_number(to_char(created_time, 'hh24')) / 6)
复制代码