日期:2014-05-18  浏览次数:20372 次

求一个Sql查询语句?
我表里有以下这两条记录,
priceid roomid price StartDate endDate
1 1 22 2008-08-08 00:00:00.000 2008-08-25 00:00:00.000
2 1 25 2008-09-01 00:00:00.000 2008-09-25 00:00:00.000
请问我想查startDate的时间为 2008-08-15 而endDate为2008-09-20
例如:select * from dbo.RoomPrice where StartDate >='2008-08-15' and endDate<='2008-09-20'
查询结果为空,一条记录也没有,这个条件是可以满足查出这两条记录的呀,请问如何写才能查出这两条数据?高手请回答。


------解决方案--------------------
select * from dbo.RoomPrice where (StartDate>='2008-08-15' and StartDate<='2008-09-20') or (endDate>='2008-08-15' and endDate<='2008-09-20')