• Looks like I made the some part of it work.

    This SQL will drop the unwanted records and now I have to somehow add the new end dates.

    delete A

    from test_data A

    join test_data b

    on a.id = b.id

    and a.type = b.type

    and a.start_dt = b.end_dt + 1