随笔-16  评论-9  文章-0  trackbacks-0
oracle sql日期比较:
在今天之前:
select * from up_date where update < to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')
select * from up_date where update <= to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')

在今天只后:
select * from up_date where update > to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')
select * from up_date where update >= to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')

精确时间:
select * from up_date where update = to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')

在某段时间内:
select * from up_date where update between to_date('2007-07-07 00:00:00','yyyy-mm-dd hh24:mi:ss'and to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss')
select * from up_date where update < to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss'and update > to_date('2007-07-07 00:00:00','yyyy-mm-dd hh24:mi:ss')
select * from up_date where update <= to_date('2007-09-07 00:00:00','yyyy-mm-dd hh24:mi:ss'and update >= to_date('2007-07-07 00:00:00','yyyy-mm-dd hh24:mi:ss')
posted on 2007-09-07 16:29 forker 阅读(88361) 评论(6)  编辑  收藏 所属分类: database

评论:
# re: oracle sql日期比较 2009-05-14 14:45 | 小三文鱼
ok  回复  更多评论
  
# re: oracle sql日期比较[未登录] 2010-11-03 17:22 | phoenix
可以使用trunc函数来精确日期到天,eg TRUNC(SYSDATE, 'DD'),这样可以语句可以简短不少  回复  更多评论
  
# re: oracle sql日期比较 2011-10-28 16:27 | 65m
aaaaaaaaaaaaaa  回复  更多评论
  
# re: oracle sql日期比较[未登录] 2012-08-06 09:53 | 1
aaaaa  回复  更多评论
  
# re: oracle sql日期比较[未登录] 2013-01-25 16:45 | ty
nice!  回复  更多评论
  
# re: oracle sql日期比较 2015-09-15 10:33 | gfgdgdd
gsssssssss  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: