oracle 取某个时间的数据(每周几的上午几点到几点)

 select count(*),t.分组字段 from (
select t.* ,to_char(t.时间,'HH24') stime,to_char(t.时间,'HH24mi') fz,to_char(时间,'d') 
from A t
where 时间>=to_date('2019-12-01','yyyy-MM-dd') and ghsj<=to_date('2019-12-31','yyyy-MM-dd') and to_char(时间,'d')='2'
) where stime in ('08','09','10','11','12')  and fz>=0800 a 
group by T.分组字段

 

to_char(时间,'d')  取当前时间是星期几  每星期第一天为周日 

to_char(t.时间,'HH24mi')  取当前时间的小时分

o_char(t.时间,'HH24') 取当前时间的小时
————————————————
版权声明:本文为CSDN博主「陈小妖」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/chenxiaojie_26/article/details/103823260

posted on 2020-01-03 17:04  棒棒糖_26  阅读(770)  评论(0编辑  收藏  举报

导航