呵呵, 你把原贴顶一下就行了,不用再发帖了。一条查询语句的话,可能有点难哦。去吃饭先。回来再想。

解决方案 »

  1.   

    declare @tb table(updata varchar(10))
    insert @tb
    select '18:00' union
    select '18:01' union
    select '18:03' union
    select '18:05' union
    select '18:08' --测试
    select [ID]=identity(int,1,1),
           *
    into #
    from @tbselect 
           A.updata,B.updata
    from (
            select * from # where ID%2=1
         )A
    join (
            select * from # where ID%2=0
         )B on A.ID+1=B.ID
    where datediff(minute,convert(datetime,convert(datetime,A.updata)),convert(datetime,B.updata))=2drop table #
    --结果
    /*
    updata     updata     
    ---------- ---------- 
    18:03      18:05(1 row(s) affected)
    */
      

  2.   

    楼上的师傅,数据很多,成千上万的,时间不可能一个个插入,而且时间是随机的,怎样才能知道下一行的时间比上一行的时间少于两分钟,只要查出少于两分钟的数据。。谢谢!!