I'm creating a 2014 cup table.
I created two tables.
times (ID, nome, sigla, bandeira)
jogos (ID, fase, local, time1_id, time2_id, data)
I have a relatively simple problem, but I did not find a search solution ... I want to make a Select that brings me the name of time1 and time2 in a query, replacing ID
.
SELECT 'jogos'.*, 'time'.'nome' FROM 'jogos'
INNER JOIN 'time' ON 'jogos'.'time1_id' = 'time'.'id' AND 'jogos'.'time2_id' = 'time'.'id'
I need to know how to pull the name of time1 and time2 through ID
..
I would be able to do some gambiarra for PHP, like a string replace , but I would like to pull the tables times the names.
How can I do this?