ITeye博客

按分钟时间段统计

ywChen · 2012-04-13 15:33 · Oracle · 数据库 · Markdown

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

 

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。