between  and  在两个时间段之间

解决方案 »

  1.   

    between and  判断不了相等··  不成立
      

  2.   

    这个问题并不是特别简单,用一句sql是不容易写出来的,这是一个判断两个时间段有没有重叠的问题,建议用程序读出来库里的时间段,再用你输入的时间段进行对比操作,从而判断有没有时间重叠
      

  3.   

    晕,用的着程序中处理么?  sql 就能解决了吧·?~
      

  4.   

    select count(*) from table where time >'xxxx,xx,xx' and time < 'xxxx,xx,xx'- - 这个    查出来一个INT类型的   其他的不用说了把。    
      

  5.   

    应该是  endtime>begintime前面的是结束时间  后面的是开始时间看下  有没有结束时间大于开始时间的。 
    有的话就是有人在。 
      

  6.   

    INSERT INTO test VALUES (  '2010-10-15 09:00:00.000', '2010-10-15 09:30:00.000');
    INSERT INTO test VALUES (  '2010-10-15 10:08:27.000', '2010-10-15 10:08:33.000');
    INSERT INTO test VALUES (  '2010-10-16 15:08:41.000', '2010-10-17 16:08:44.000');declare @btime smalldatetime,@etime smalldatetime
    select @btime='2010-10-15 09:02:01'
    select @etime='2010-10-15 10:00:33'
    select * from test where ((@bTime>=beginTime and @bTime<endTime) 
    or (@bTime<endTime and @eTIme>endTime) or (@bTime<=beginTime and @eTIme>beginTime)
    )
      

  7.   

    可以考虑用排除法的:NOT (eTime<beginTime OR bTime>endTime)