Mr Chris Posted June 14, 2009 Share Posted June 14, 2009 Hi All, I am trying to join three tables with this query: select pl.player_name AS the_player, pl.player_id, s.report_id from players as pl left outer join player_stats as s on s.player_id = pl.player_id left outer join r.reports as r on r.report_id = s.report_id where pl.player_id = 22 However I get the message: SELECT command denied to user 'my_user_name'@'localhost' for table 'reports' However if I just do it without the last join e.g. just a two table: select pl.player_name AS the_player, pl.player_id, s.report_id from players as pl left outer join player_stats as s on s.player_id = pl.player_id where pl.player_id = 22 It works fine, so it's getting lost somewhere here on the third join: left outer join r.reports as r on r.report_id = s.report_id But cant see where? Any ideas? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/162126-help-with-a-three-table-join/ Share on other sites More sharing options...
trq Posted June 14, 2009 Share Posted June 14, 2009 Its not getting lost anywhere. The user your communicating with mysql as does not have permissions to execute SELECT queries on the reports table. Quote Link to comment https://forums.phpfreaks.com/topic/162126-help-with-a-three-table-join/#findComment-855533 Share on other sites More sharing options...
Mr Chris Posted June 14, 2009 Author Share Posted June 14, 2009 That's the thing though, if I just do a simple: Select * from reports It works with no problem?? Quote Link to comment https://forums.phpfreaks.com/topic/162126-help-with-a-three-table-join/#findComment-855534 Share on other sites More sharing options...
Ken2k7 Posted June 14, 2009 Share Posted June 14, 2009 Remove the r. in r.reports. It should be just LEFT OUTER JOIN reports, not LEFT OUTER JOIN r.reports. Makes no sense. It's a minor mistake, I'm sure. Quote Link to comment https://forums.phpfreaks.com/topic/162126-help-with-a-three-table-join/#findComment-855663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.