日期:2014-05-20  浏览次数:20652 次

sql中日期查询问题
数据库中日期和时间是两个字段:DD(datetime),HH(int)
我现在想查找2007-2-1日12点到2007-2-3日11点之间的数据,要怎么写sql语句阿?
帮忙把where后面的语句告诉我,谢谢

------解决方案--------------------
select * from t
where dd> = '2007/02/01 ' and dd <= '2007/02/03 '
and case when dd= '2007/02/01 ' then hh else 13 end > 12
and case when dd= '2007/02/03 ' then hh else 10 end <11

*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)

最新版本:20070130

http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html