title: SQL Left Join returning NULL value
body: <p>I have a databse with tables <code>schedule</code> and a table <code>teams</code> (as can be seen in image below) Im trying to use the <code>homeID</code> &amp; <code>awayID</code> inside the the <code>schedule</code> table to do a join on the <code>teams</code> table....Problem is it is returning NULL</p>
  
  <p><strong>DB Layout</strong></p>
  
  <p><a href="https://i.stack.imgur.com/5Q1yY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Q1yY.png" alt="enter image description here"></a></p>
  
  <p><strong><code>Schedule</code> Table Layout</strong></p>
  
  <p><a href="https://i.stack.imgur.com/orwNE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/orwNE.png" alt="enter image description here"></a></p>
  
  <p><strong><code>teams</code> table layout</strong></p>
  
  <p><a href="https://i.stack.imgur.com/VaH7T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VaH7T.png" alt="enter image description here"></a></p>
  
  <p><strong>My Query</strong></p>
  
  <pre><code>SELECT s.*,
    t1.teamId as homeId_teamId,
    t1.teamCode as homeId_teamCode,
    t1.teamName as homeId_teamName,
    t2.teamId as visitorId_teamId,
    t2.teamCode as visitorId_teamCode,
    t2.teamName as visitorId_teamName
  FROM schedule s
    LEFT JOIN teams t1 ON s.homeId = t1.teamName
    LEFT JOIN teams t2 ON s.visitorId = t2.teamName
  WHERE  gameID = '1';
  </code></pre>
  
  <p><strong>Returned Result</strong></p>
  
  <p><a href="https://i.stack.imgur.com/eYqZX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eYqZX.png" alt="enter image description here"></a></p>
  
  <p>Any idea why am I getting a NULL value for the join? What am I missing here? Any help appreciated.</p>