高分求sql查询语句?
priceid  roomid  price    StartDate                endDate  
1         1       22      2008-08-08              2008-08-25
2         1       25      2008-09-01              2008-09-25  
请问我给出一下时间段 2008-08-15 到2008-09-20 你是否能写一个查询语句把这两条数据查询出来?
------解决方案--------------------between语句就可以了,自己去看书
------解决方案--------------------select * from  table where StartDate<'2008-08-15' or endDate >'2008-09-20 '
------解决方案--------------------select * from  table where StartDate >'2008-08-15' and endDate <'2008-09-20 '
查询这两个日期之前的数据
------解决方案--------------------查询这两个日期之间的数据
..打错一个字-.-
------解决方案--------------------SELECT     *
FROM         test
WHERE     (StartDate >= '2008-08-15') OR(endDate <= '2008-09-20')
------解决方案--------------------select * from  table where StartDate <'2008-08-15' or endDate >'2008-09-20 '
------解决方案--------------------select * from  table where StartDate >='2008-08-15' and endDate <='2008-09-20 '
------解决方案--------------------create table T1
(
	priceid  int,
	roomid  int,
         price decimal(18,9),
	StartDate datetime,
	endDate datetime
)
insert into T1
select 1,1,22,'2008-08-08','2008-08-25' union all
select 2,1,25,'2008-09-01','2008-09-25'
select * from T1
where StartDate<='2008-08-15' or endDate>='2008-09-20 '
------解决方案--------------------select * from  table where StartDate >='2008-08-15' and endDate <='2008-09-20 '
------解决方案--------------------楼上都写么这么多了
还不揭帖?