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

2022-10-11,,,,

 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

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

下载本文的Word格式文档,以方便收藏与打印。