1, 如果表中有字段记录时间的话,就直接查询: select count(1) from tb_xxx where 时间字段between to_date('201210210800','yyyymmddhh24miss') and ('201210210900','yyyymmddhh24miss'); 2,如果没有时间字段记录,可以弄个job什么的,一小时查询一下,记录统计结果。
where 时间字段between to_date(sysdate + (-1/24),'yyyymmddhh24miss') and (sysdate,'yyyymmddhh24miss');
select to_char(时间字段,'yyyymmddhh') tmpdate, count(*) contbyh from tablename group by tmpdate
select trunc(date), sum(data) over(partition by to_char(date,'yyyy/mm/dd hh24') from tablename
select count(1) from tb_xxx where 时间字段between to_date('201210210800','yyyymmddhh24miss') and ('201210210900','yyyymmddhh24miss');
2,如果没有时间字段记录,可以弄个job什么的,一小时查询一下,记录统计结果。
sum(data) over(partition by to_char(date,'yyyy/mm/dd hh24')
from tablename