mySQL LEFT join

Soldato
Joined
18 Oct 2002
Posts
4,892
Got a slight problem with a left join in mySQL, The codes below.
This works perfectly in mySQL 3.whatever or 4.whatever but on my localhost u've just put mySQL version 5 and its not liking the LEFT join park of the code any ideas why??

Heres the error: #1054 - Unknown column 'fixtures.away_team_id' in 'on clause'

Code:
"SELECT fixtures.fixture_id, 
	 fixtures.fixture_date, 
	 fixtures.home_team_id,
	 teams.team_name AS home_team, 
	 fixtures.away_team_id,
	 awayTeam.team_name AS away_team, 
	 fixtures.fixture_status
	        						      
	  FROM fixtures, teams
	  LEFT JOIN teams AS awayTeam ON fixtures.away_team_id = awayTeam.team_id
	  WHERE fixtures.home_team_id = teams.team_id
	  AND fixtures.fixture_id = $id"
 
Soldato
OP
Joined
18 Oct 2002
Posts
4,892
thanks mate,
had a look in the Joins secition here http://dev.mysql.com/doc/refman/5.0/en/join.html but still non the wiser. Is it me or are the help pages on the mySQL site a touch on the pants side.

Update:

Sorted: seems that you now have to wrap your tables in the from clause with parentheses. ummmm

thanks again mate for pointing me in the right direction
 
Last edited:
Back
Top Bottom