Symmetric Pairs

  • + 0 comments
    select * from
    ((select f1.x,f1.y from functions f1
    inner join functions f2
    on f1.x = f2.y and f1.y = f2.x and f1.x!=f2.x and f1.y!=f2.y)
    
    union
    
    (select x,y from
    (select x,y,count(x),count(y) from functions
    group by x,y
    having count(x)>1)x))pairs
    where x<=y
    order by x;