当前位置: 移动技术网 > IT编程>数据库>Oracle > oracle 取某个时间的数据(每周几的上午几点到几点)

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

2020年01月04日  | 移动技术网IT编程  | 我要评论

 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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网