Between的用法

来源:百度知道 编辑:UC知道 时间:2024/06/30 20:13:17
有一个表"A",其中有个字段是"creat_date",其值表现为:"2007-11-7 09:20:05",请问如果我要查询值在"2007-10-25 19:49:05"和"2007-10-27 19:49:05"之间的如何如查?谢谢!

例:select * from A where creat_date between 2007-10-25 19:49:05 and 2007-10-27 19:49:05

但这个好像不对!
请高人指点,谢谢!

对啊.怎么不对了?

select * from A where creat_date between '2007-10-25 19:49:05' and '2007-10-27 19:49:05'

看你是什么了,sql的就是楼上说的,oracle的日期要这样写to_date('2007-10-25 19:49:05','yyyy-mm-dd hh24:mi:ss')