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

以起始日期和截止日期为条件查询在日期范围的相关数据,这个语句怎么写啊
以起始日期和截止日期为条件查询在日期范围的相关数据,要求一张表中有两个日期范围条件,也就是说同时查询不同的日期范围的数据.

------解决方案--------------------
select * from 表 where (日期 between 起始日期1 and 截止日期1) or(日期 between 起始日期2 and 截止日期2)
------解决方案--------------------
select * from 表 where 日期 between 起始日期1 and 截止日期1
union all
select * from 表 where 日期 between 起始日期2 and 截止日期2