Symmetric Pairs

  • + 0 comments

    WITH functions_row_n AS( SELECT x, y, ROW_NUMBER() OVER(ORDER BY x, y) row_n FROM functions)

    SELECT DISTINCT a.x, a.y FROM functions_row_n a, functions_row_n b WHERE a.row_n <> b.row_n AND a.x = b.y AND a.y = b.x AND a.x <= a.y;