按分钟时间段统计

select

 to_char((trunc(sysdate) +
         trunc((end_time - trunc(sysdate)) * 24 * 60 / 40) * 40 / 60 / 24),
         'hh24:mi') || '-' ||
 to_char((trunc(sysdate) +
         trunc((end_time - trunc(sysdate)) * 24 * 60 / 40 + 1) * 40 / 60 / 24),
         'hh24:mi') period,
 
 sum(run_times) "ROWS",
 flow_node_code

  from tb_soc_flow_node_status

 group by to_char((trunc(sysdate) +
                  trunc((end_time - trunc(sysdate)) * 24 * 60 / 40) * 40 / 60 / 24),
                  'hh24:mi') || '-' ||
          to_char((trunc(sysdate) +
                  trunc((end_time - trunc(sysdate)) * 24 * 60 / 40 + 1) * 40 / 60 / 24),
                  'hh24:mi'),
          flow_node_code
 


 

猜你喜欢

转载自ywchen.iteye.com/blog/1485364