sql server - Retrieving a SQL some rows having first two with date difference more than 120 seconds -


i have table column that's datetime. suggest me if there's way retrieve next 20 records starting when find first 2 ones have datediff > 120 seconds? possible?...

it find first stop of coordinates list.

thanks in advance everyone!

cheers, luigi

select top 20 * log dt >= (select min(dt) log l -- not sure looking >= or =             exists(select * log l2                           datediff(ss,l.dt,l2.dt)>120                          , l.dt=(select max(dt) log l3 l3.dt<l2.dt)                         ) ) 

sql-fiddle


Comments