I have the following simple data set: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
I would like to procude the following 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
Any suggestions please?