oracle时间查询

来源:互联网 发布:自学php用什么书 编辑:程序博客网 时间:2024/05/21 13:55
select f.* from tab_regulation   f
where  '1987/8/8'<f.release_date < '2012/5/9'
 and  '1987/8/8'<f.apply_date < '2012/5/9'
 --错误的
 
 select  f.* from tab_regulation   f 
where (
(f.release_date between to_date('1987-8-8','YYYY-MM-DD') and to_date('2012-5-9','YYYY-MM-DD'))
 and 
(f.apply_date between to_date('1987-8-8','YYYY-MM-DD') and to_date('2012-5-9','YYYY-MM-DD')))
--输出3
 
 select  f.* from tab_regulation   f 
where (
(f.release_date between  to_date('1987-8-8 12:00:00','yyyy/mm/dd HH24:mi:ss') and  to_date('2012-5-9 23:59:59','yyyy/mm/dd HH24:mi:ss'))
 and 
(f.apply_date between to_date('1987-8-8 12:00:00','yyyy/mm/dd HH24:mi:ss') and  to_date('2012-5-9 23:59:59','yyyy/mm/dd HH24:mi:ss')))
--输出9
原创粉丝点击