I have the table matches
| id_match | id_team1 | id_team2 |
|---|---|---|
| 1 | USA | JPN |
| 2 | AUS | USA |
| 3 | CAN | POL |
| 4 | POL | USA |
and the table teams
| id_team | name |
|---|---|
| USA | United States |
| JPN | Japan |
| ... | ... |
And i want to return a new table of teams that have never played each other like this
| id_team1 | id_team2 |
|---|---|
| USA | AUS |
| CAN | USA |
| ... | ... |
I think i have to use cross join and a subtraction but i can't think exactly how to do it. if anyone can think of how to do it, or a simpler way, i'd really appreciate it!