zoukankan      html  css  js  c++  java
  • 最近七天的数据每天相互对比

    select tb7.MM,cpu7,cpu6,cpu5,cpu4,cpu3,cpu2,cpu1 from

    (select substr(mi,-5) mm,cpu7 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu7 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 18), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 17), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 18),'yyyy/mm/dd')||'%') tb7 ,

    (select substr(mi,-5) mm,cpu6 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu6 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 17), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 16), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 17),'yyyy/mm/dd')||'%') tb6 ,

    (select substr(mi,-5) mm,cpu5 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu5 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 16), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 15), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 16),'yyyy/mm/dd')||'%') tb5 ,

    (select substr(mi,-5) mm,cpu4 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu4 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 15), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 14), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 15),'yyyy/mm/dd')||'%') tb4 ,

    (select substr(mi,-5) mm,cpu3 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu3 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 14), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 13), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 14),'yyyy/mm/dd')||'%') tb3 ,

    (select substr(mi,-5) mm,cpu2 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu2 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 13), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 12), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 13),'yyyy/mm/dd')||'%') tb2 ,

    (select substr(mi,-5) mm,cpu1 from
    (select to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') mi,avg(PARAMETER_VALUE) cpu1 from SANDBOXUSER.BMC_CPU
    where to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi') BETWEEN TO_CHAR ( trunc(SYSDATE - 12), 'yyyy/mm/dd hh24:mi' )
    AND TO_CHAR ( trunc(SYSDATE - 11), 'yyyy/mm/dd hh24:mi' )
    group by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi')
    order by to_char(SAMPLE_TIMESTAMP_UTC,'yyyy/mm/dd hh24:mi'))
    where  mi like TO_CHAR(trunc(SYSDATE - 12),'yyyy/mm/dd')||'%') tb1

    where tb1.mm = tb2.mm and tb3.mm = tb2.mm and tb3.mm = tb4.mm and tb4.mm = tb5.mm and tb5.mm = tb6.mm and tb6.mm = tb7.mm

  • 相关阅读:
    Java回调机制
    显示Title和隐藏Title的ListView
    ListView的小知识
    小知识点
    Shader的使用
    项目知识(二)
    项目知识(一)
    复习篇(一)Activity的生命周期和启动模式
    BootStrap 提示框
    BootStrap选项卡
  • 原文地址:https://www.cnblogs.com/lmfeng/p/2118098.html
Copyright © 2011-2022 走看看