Symmetric Pairs

  • + 1 comment

    Simple Query for mySQL: with Temp as ( select row_number()over (order by f1.x asc) as r,f1.x,f1.y from functions f1) select T1.x,T1.y from temp T1 join Temp T2 on T1.x=T2.y and T1.y=T2.x and T1.r != T2.r where T1.x<=T1.y group by T1.x,T1.y order by T1.x