Skip to content
Advertisement

INNER JOIN twice form the same table

I have 2 database tables that I want to JOIN.

DB table 1 had football fixtures in it. So Team A plays Team B and the score was. The data comes from an API and in this DB table the teams are numbers instead of actual names.

In the second DB table I have a list of all the teams names with their ID. Those ID’s are give in DB table 1.

I’ve managed to INNER JOIN the home teams, but I can’t figure out how I can JOIN the away teams as well.

This is what I have so far. I don’t manage to get the visitors teams matched via INNER JOIN.

Advertisement

Answer

Since you are going to use the same table again you need to use alias

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement