title: mySQL - how to flatten records and subrecords
body: <p>I have two tables, that are something like this:</p>
  
  <pre><code>records
  [id, submitted_date, username]
  
  1,  2012-10-20, jjones
  2,  2012-10-22, jsmith
  
  
  subrecords
  [id, record, name, value]
  
  1,  1,  Street, 123 Elm
  2,  1,  City,   Chicago
  3,  2,  Street, 321 Maple
  4,  2,  City,   New York
  </code></pre>
  
  <p>I am using a form tool that saves things this way.</p>
  
  <p>In separate custom PHP, however, I want to get query results like:</p>
  
  <pre><code>jjones, 123 Elm, Chicago
  jsmith, 321 Maple, New York
  </code></pre>
  
  <p>How do I do this?  The best I can figure out so far is output like</p>
  
  <pre><code>jjones, Street, 123 Elm
  jjones, City, Chicago
  jsmith, Street, 321 Maple
  jsmith, City, New York
  </code></pre>
  
  <p>Which is not what I need. I want to get the results all together in the data rows returned from the query.</p>