title: Transpose latest rows per user to columns
body: <p>I have the following table, which gives multiple email addresses for each user.</p>
  <p><a href="https://i.stack.imgur.com/0riT6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0riT6.png" alt="table sample" /></a></p>
  <p>I need to flatten this out to columns on a user query. To give me the &quot;newest&quot; 3 email addresses based on the creation date. Like:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>user_name</th>
  <th>user_id</th>
  <th>email1</th>
  <th>email2</th>
  <th>email3</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Mary</td>
  <td>123</td>
  <td>mary@gmail.com</td>
  <td>mary@yahoo.co.uk</td>
  <td>mary@test.com</td>
  </tr>
  <tr>
  <td>Joe</td>
  <td>345</td>
  <td>joe@gmail.com</td>
  <td>[NULL]</td>
  <td>[NULL]</td>
  </tr>
  </tbody>
  </table>
  </div>