Home Forums SQL Server 2012 SQL Server 2012 - T-SQL overlap query where to and from can be same ( of next and previous range) RE: overlap query where to and from can be same ( of next and previous range)

  • Okay, since you insist on us taking a shot in the dark, here is mine:

    '

    -- Using your sample data posted above

    declare @pointfrom int = 2,

    @pointto int = 10;

    select * from #t;

    select a.*

    from #t a

    where

    a.t >= @pointfrom and

    a.f <= @pointto;

    Output from the first query:

    ft

    15

    56

    79

    1011

    1112

    Output from the second query: -- is this what you are looking for?

    ft

    15

    56

    79

    1011