• Unfortunately my solution isn't working as expected. Anyone else with suggestions?

    Here is some sample data:

    with SCC_CTE (Retained_ID, Dropped_ID)

    AS (Select 15799, 8388 union all

    select 52941,8388 union all

    select 52941, 15799 union all

    select 80833, 8388 union all

    select 80833, 15799)

    select * from SCC_CTE

    And here is the expected out output:

    ;with Result_CTE (Retained_ID, Dropped_ID)

    AS (Select 80833, 8388 union all

    select 80833,15799 union all

    select 80833, 52941)

    select * from Result_CTE

    Thanks in advance.

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn