Symmetric Pairs

  • + 0 comments

    Update: Forgot to order the output. It works once I added "order by a.x"...

    WITH CTE AS ( select *, row_number() over(order by X asc) as rowN from Functions)

    select distinct a.X, a.Y from CTE a inner join CTE b on a.X = b.Y and a.Y = b.X where a.rowN != b.rowN and a.X <= a.Y;