title: SQL query horizontal display and join
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5826455/join-two-tables-with-a-1-m-relationship-where-the-second-table-needs-to-be-fl">Join two tables (with a 1-M relationship) where the second table needs to be ‘flattened’ into one row</a>  </p>
  </blockquote>
  
  
  
  <p>Although I took a intro to sql course, I cannot figure this one out at the moment.</p>
  
  <p>I have two tables :</p>
  
  <p>table1:</p>
  
  <pre><code>    user_id date  value
      ids     dates values
  </code></pre>
  
  <p>table2:</p>
  
  <pre><code>    user_id user_names
      ids     names
  </code></pre>
  
  <p>I would like a MYSQL query that would display the following results:</p>
  
  <pre><code>    /   name1  name2  name3 etc
    date1 val1-1 val1-2 val1-3 
    date2 val2-1 val2-2 val2-3
  </code></pre>
  
  <p>I remember there is a way to do that, right? any help would be appreciated.</p>