title: How to join two tables using different ID but are related
body: <p>I am trying to fetch data from the parent table using a child table but there seems to be an error I am doing while trying to implement this</p>
  
  <p>I have tried to use a join statement but fail every time upon executing the statement. The code should fetch the data using the following fields:</p>
  
  <pre><code>Parent table COMPETITIONS
       1. comp_id - linked to fixtures table
       2. comp_name
  
  
  Parent table TEAMS:
       1. team_id - linked to home_teamID &amp; away_teamID
       2. team_name
       3. team_email
  
  Child table FIXTURES:
      1. fixture_id
      2. fixture_date
      3. fixture_time
      4. home_teamID - linked to the team's table [team_id]
      5. away_teamID - linked to the team's table [team_id]
      6. comp_id - linked to the competitions table
  </code></pre>
  
  <p>I tried using a join, but the error I get is that there an exception near the 'teams' clause of my "JOIN ON" syntax.</p>
  
  <p>The expected results are a table that contains all the FIXTURES records which have been select or extracted from the parent tables. But the error I seem to get is that MySQL is not allowing me to access the TEAMS table using the field HOME_TEAMid and AWAY_TEAMid. However, both fields are related to the Teams table as aforementioned</p>