oracle SQL语句中怎么查询一个月内固定时间段的数据,比如9月1号到10月1号每天的八点到九点的呼叫数目
展开全部
使用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 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'
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'
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询