I have been reading up on joins, but I still am a bit unclear how I would write my query to do the following.
I have a table named teams
| ID | Teamname |
| 1 | The Good Team |
| 2 | The Bad Team |
And a table named matchups
| ID | Team1 | Team2 |
| 1 | 1 | 2 |
I want to query the matchups table and pull the teamnames from the teams table.
"SELECT matchups.team1, teams.teamname as team1, matchups.team2, teams.teamname as team2 FROM matchups join teams on matchups.team1 = teams.id "
The join has one team id = to the id in the team table, but what about the other team?
");