--子集select * from [tab] where starttime >= '2008-11-02' and endtime <= '2009-11-20'--交集 select * from [tab] where starttime <= '2009-11-20 'and endtime >= '2008-11-02'
--只要区间在所给区间内 select * from 表名 where StartTime between '2008-11-02' and '2009-11-20' or EndTime between '2008-11-02' and '2009-11-20' --严格在所给区间内 select * from 表名 where StartTime>='2008-11-02' and EndTime <='2009-11-20'
select * from ta where (starttime > '2008-11-02' and EndTime <'2009-11-20 ') or(starttime > '2008-11-02' and starttime >'2009-11-20 ') or(EndTime > '2008-11-02' and EndTime <'2009-11-20 ')
select * from tb where StartTime >= '2008-11-02' and EndTime<= '2009-11-20' --還是不敢確定你是不是這個意思。
-- select * from tb where StartTime >= '2008-11-02' and EndTime<= '2009-11-20' --最把表的记录写下来,得知道你的表是什么用!
枪手好象还是不对: select * from 表名 where StartTime between '2008-11-02' and '2009-11-20' or EndTime between '2008-11-02' and '2009-11-20' or (StartTime<'2008-11-02' and EndTime<'2009-11-20')
漂亮!SQL code --子集select * from [tab] where starttime >= '2008-11-02' and endtime <= '2009-11-20'--交集 select * from [tab] where starttime <= '2009-11-20 'and endtime >= '2008-11-02'测试成功! 谢谢
--子集select * from [tab] where starttime >= '2008-11-02' and endtime <= '2009-11-20'--交集
select * from [tab] where starttime <= '2009-11-20 'and endtime >= '2008-11-02'
select * from 表名 where StartTime between '2008-11-02' and '2009-11-20' or EndTime between '2008-11-02' and '2009-11-20'
--严格在所给区间内
select * from 表名 where StartTime>='2008-11-02' and EndTime <='2009-11-20'
select *
from ta
where (starttime > '2008-11-02' and EndTime <'2009-11-20 ')
or(starttime > '2008-11-02' and starttime >'2009-11-20 ')
or(EndTime > '2008-11-02' and EndTime <'2009-11-20 ')
select * from tb where StartTime >= '2008-11-02' and EndTime<= '2009-11-20'
--還是不敢確定你是不是這個意思。
select * from tb where StartTime >= '2008-11-02' and EndTime<= '2009-11-20'
--最把表的记录写下来,得知道你的表是什么用!
select * from 表名 where StartTime between '2008-11-02' and '2009-11-20'
or EndTime between '2008-11-02' and '2009-11-20'
or (StartTime<'2008-11-02' and EndTime<'2009-11-20')
--子集select * from [tab] where starttime >= '2008-11-02' and endtime <= '2009-11-20'--交集
select * from [tab] where starttime <= '2009-11-20 'and endtime >= '2008-11-02'测试成功!
谢谢