title: MySQL query to select all results from table 2 that match table 1
body: <p>I have pages stored in the database, and another table that stores translations of that same page:</p>
  
  <p>Table page_pages:</p>
  
  <pre><code>ID    Title        Content
  1     First Page   Stuff...
  2     Second Page  More stuff...
  </code></pre>
  
  <p>Table page_translations:</p>
  
  <pre><code>ID    PageID    LanguageID    Title             Content
  1     1         2             Primero pagina    Cosas...
  </code></pre>
  
  <p>So, right now I am querying the <code>page_pages</code> table to get the page information:</p>
  
  <pre><code>$query = SELECT * FROM page_pages WHERE ID = 1
  </code></pre>
  
  <p>How do I adjust this query to select translations that exist with the <code>PageID</code> AS <code>Translations</code>, and have that be it's own array with the <code>LanguageID</code> as the array keys?</p>
  
  <p>This way, I can check if a translation exists like:</p>
  
  <pre><code>$language_id = 1;
  
  if (isset($query['Translations'][$language_id])) {
    echo $query['Translations'][$language_id]['Title'];
  
  } else {
    echo $query['Title'];
  }
  </code></pre>