title: MySQL Merge Row Values into single Row
body: <p>I need to create a select query for a table which merges the rows per group on the 'Number' column to get a single row with all available yet latest (By ID) columns.</p>
  
  <p>Here's what I mean, I need to take a table like this:</p>
  
  <pre><code>ID | Number |   Date 1   |   Date 2   |   Date 3   |
  ----------------------------------------------------
  1  |   1    | 2011-10-01 |    NULL    |    NULL    |
  2  |   1    |    NULL    | 2011-10-25 |    NULL    |
  3  |   1    |    NULL    |    NULL    | 2011-11-13 |
  4  |   1    | 2011-10-03 |    NULL    | 2011-11-10 |
  5  |   2    |    NULL    |    NULL    | 2012-01-01 |
  6  |   2    | 2012-03-11 |    NULL    |    NULL    |
  </code></pre>
  
  <p>And return this (The ID column being unrelated to the above ID column):</p>
  
  <pre><code>ID | Number |   Date 1   |   Date 2   |   Date 3   |
  ----------------------------------------------------
  1  |    1   | 2011-10-03 | 2011-10-25 | 2011-11-10 |
  2  |    2   | 2012-03-11 |    NULL    | 2012-01-01 |
  </code></pre>
  
  <p>So for all rows in each Group By the 'Number' column, I need all available column values from all rows in the group, but only the latest value for each column. The latest being determined by the highest value of 'ID' where a value in the column exists. 
  (If no value in the column exists on any row in the group, then a value of Null is used).</p>
  
  <p>Thanks</p>