版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
按半小时分组
select
case when substr( to_char(capturetime, 'yyyy-mm-dd hh24:mi'),15, 16) :: integer <=30
then to_char( capturetime, 'yyyy-mm-dd hh24')||':30'
else to_char( capturetime, 'yyyy-mm-dd hh24')||':00'
end as row_date2, count(1)
from t_ori_mac_data_xinwangcheng
where capturetime >= '2019-09-03'
group by row_date2
按一小时分组
select to_char(capturetime,'hh24'),count(mac)
from t_ori_mac_data_xinwangcheng
where capturetime >= '2019-09-03'
group by to_char(capturetime,'hh24')