Symmetric Pairs

  • + 0 comments

    with f1_temp as ( select x, y, count(*) as cnt from functions where x <= y group by x , y )

    , f2_temp as( select x, y from functions where x > y )

    select f1.x, f1.y from f1_temp f1 where f1.cnt >1 or ( f1.x in (select f2.y from f2_temp f2 ) and f1.y in (select f2.x from f2_temp f2 ) ) order by f1.x asc