Symmetric Pairs

  • + 0 comments

    Select sth.X,sth.Y from ( select f1.X as X, f1.Y AS Y --, f2.X as X2,f2.Y as Y2 from functions f1 CROSS JOIN functions f2 where f1.X< f1.Y and f1.X = f2.Y and f2.X = f1.Y

    UNION

    SELECT X, Y from functions where X = Y group by X,Y having count(*) > 1) sth Order by sth.X,sth.Y