Q6_m

 avatar
kuber
plain_text
4 years ago
404 B
4
Indexable
select f1.x, f1.y
from functions f1
    inner join functions f2 on f1.x= f2.y and f1.y = f2.x
    /* removing duplicates: count removes pairs where f1.x = f1.y as it matches with itself where       as f1.x < f1.y removes duplicate pairs where f1.x < f1.y as there is anothere pair f2.x <          f2.y that matches the f1 pair */
group by f1.x, f1.y
having count(f1.x)>1 or f1.x<f1.y      
order by f1.x;
Editor is loading...