title: Pivoting and transposing
body: <p>I have the following table:</p>
  
  <pre><code> |fk ID|value | val id|
   |  1  | val11|  1    |
   |  1  | val12|  2    |
   |  2  | val21|  1    |
   |  2  | val22|  2    |
  </code></pre>
  
  <p>I want to transpose it to:</p>
  
  <pre><code> | fk ID | val1Title | val2Title |
   | 1     | val11     | val12     |
   | 2     | val21     | val22     |
  </code></pre>
  
  <p>Ive added an ID column to the top table which is used to order so we know that val11 is in the first column because it has an id less that val12.</p>
  
  <p>I have an oracle DB and I think I need to pivot. I've found a couple of articles on it (e.g. <a href="https://stackoverflow.com/questions/12926901/transposing-table">Transposing Table</a>) although it seems to be a lot of work for the pivot. Is this the easiest way?</p>
  
  <p>How can I easily transpose? Im using Oracle 11g so am happy to use Oracle specific functions. I've used <code>ListAgg</code> but that combines the columns. I want to columns separate though.</p>
  
  <p>EDIT: The design of the original table is not normalised at the moment because this is actually the result of quite a complicated query.</p>