title: Simple Mysql table join problem
body: <p>I'm designing a website to teach myself how to use table joins in mysql and have got stuck pretty early on. (The numbers are Wii friend codes, if that helps you make sense of this!)</p>
  
  <p>I have 3 tables:</p>
  
  <p>users:</p>
  
  <pre><code>id, firstname, surname
  </code></pre>
  
  <p>games:</p>
  
  <pre><code>id, title
  </code></pre>
  
  <p>numbers:</p>
  
  <pre><code>number, users_id, game_id
  </code></pre>
  
  <p>The number is a unique code that belongs to the user and associates with a game.</p>
  
  <p>I'm trying to get out a list of numbers for a specific game along with the names of the users they belong to.</p>
  
  <p>I'm running the query:</p>
  
  <pre><code>SELECT firstname, surname, number FROM games, users, numbers WHERE numbers.game_id = games.id AND games.title = 'foogame'
  </code></pre>
  
  <p>for instance, to get out all the numbers belonging to foogame. However, this returns any user who doesn't have a code for this game with a random code from another user. How do I make this query only return the users who actually have a code for that game?</p>