I have this table called FEATURING:
* Artist_1, join_phrase, Artist_2 *
Shakira feat. Rihanna
Eminem feat. Rihanna
Sia feat. Eminem
SeanPaul feat. Sia
Queen feat. DavidBowie
LadyGaga feat. Beyonce
LadyGaga feat. Eminem
I need to specify a SQL query that take pairs (name of Artist_1, name of Artist_2) of artists who have never collaborated with each other but have collaborated with another artist in common
for example: X feat Y, Z feat Y ---> (X, Z) is the solution
The result it would be:
* Artist_1, Artist_2 *
Shakira Eminem
Eminem SeanPaul
Beyonce Eminem
LadyGaga Rihanna
Sia Rihanna
Sia LadyGaga
How I can solve? Thank you very much!