How to get row of first change?

  • Thank you again for the assistance and education. I will be more careful with my test data next time. The system locks up whenever I try to post anything too long, so here is my shortened version

    with ordered as (

    select d.a, d.b, d.dte

    , _a = lag(a, 1, null) over (order by a, dte)

    , _b = lag(b, 1, null) over (order by a, dte)

    from #date d)

    select *

    from ordered o

    where not exists (select o.a, o.b

    intersect

    select o._a, o._b);

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply