I am wanting to get data from one table using information from one. How would I go about doing this?
The ftv_match table has a home team and an away team id which relate to the ftv_team table. So what I want to be able to do is get the team names for both of them from the ftv_team table. The code I have at the moment only gets the name for the home team. What do I need to change to get the name for the away team too?
SELECT * FROM ftv_match
ON ftv_match.home = ftv_team.id
Example row from ftv_match
id home away competition date time channel
5545 243 433 12 2010-07-03 124500 2
, h.name AS home_team_name
, a.name AS away_team_name
FROM ftv_match AS m
JOIN ftv_team AS h
ON h.id = m.home
JOIN ftv_team AS a
ON a.id = m.away