34,874
社区成员
发帖
与我相关
我的任务
分享select
a.*
from
(select id=row_number()over(order by getdate()),* from tb) a,
(select id=row_number()over(order by getdate()),* from tb) b
where
a.id=b.id-1
and
datediff(ss,a.time,b.time)<=2??
SELECT * FROM @a a WHERE
datediff(ss,date,(SELECT min(date) FROM @a WHERE date>a.date))<=2
OR
datediff(ss,(SELECT max(date) FROM @a WHERE date<a.date),date)<=2select
a.*
from
tb a,tb b
where
a.id=b.id-1
and
datediff(ss,a.time,b.time)<=2