Jump to content

Help with a three table join?


Mr Chris

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/162126-help-with-a-three-table-join/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.