It's quite simple problem but I am begginer and i have problems with it.
I have 2 tables in database
- matches id, team1id, team2id, score, date
- teams id, name
If I want to select team1 name, team2 name, score and date what command should I use?
It's quite simple problem but I am begginer and i have problems with it.
I have 2 tables in database
If I want to select team1 name, team2 name, score and date what command should I use?
You should use a double "join" on teams table. I wrote a sheet of how you should use it :
select
matches.id,
teamA.name,
teamB.name,
score,
date
from matches
inner join teams teamA
on teamA.id = matches.team1id
inner join teams teamB
on teamB.id = matches.team2id