数据库里 没一小时上一条数据。
数据中上的是事件数量递增的信息。
我想查出来每小时,新上来的数据量,这个SQL 应该怎么写啊 ? 
想了好几天都没想出来。

解决方案 »

  1.   

    1, 如果表中有字段记录时间的话,就直接查询:
    select count(1) from tb_xxx where 时间字段between to_date('201210210800','yyyymmddhh24miss') and ('201210210900','yyyymmddhh24miss');
    2,如果没有时间字段记录,可以弄个job什么的,一小时查询一下,记录统计结果。
      

  2.   

    where 时间字段between to_date(sysdate + (-1/24),'yyyymmddhh24miss') and (sysdate,'yyyymmddhh24miss');
      

  3.   

    select to_char(时间字段,'yyyymmddhh') tmpdate, count(*) contbyh from tablename group by tmpdate 
      

  4.   

    select trunc(date),
           sum(data) over(partition by to_char(date,'yyyy/mm/dd hh24')
           from tablename