使用Oracle 函数extract(fmt from d)获取日期中的特定部分: select count(*) from table where SQL> select * from table where createdate between to_date('2010-9-1','yyyy-MM-dd') and to_date('2010-10-1','yyyy-MM-dd') and EXTRACT(hour from createdate) between '8:00' and '9:00';
select a.日期,count(*) from 表名 a where to_char(a.具体时间,'HH') <= '21' and to_char(a.具体时间,'HH')>='20' group by a.日期 having to_char(a.日期,'YYYY-MM-DD')<='2011-10-01' and to_char(a.日期,'YYYY-MM-DD')>='2011-09-01'本回答被网友采纳