title: Using pivot on multiple columns of an Oracle row
body: <p>I have the following sample data in an Oracle table (<code>tab1</code>) and I am trying to convert rows to columns. I know how to use Oracle pivot on one column. But is it possible to apply it to multiple columns?  </p>
  
  <p>Sample data:  </p>
  
  <pre><code>Type  weight  height  
  A     50      10  
  A     60      12  
  B     40      8  
  C     30      15  
  </code></pre>
  
  <p>My intended output:  </p>
  
  <pre><code>A-count B-count C-count A-weight B-weight C-weight A-height B-height C-height  
  2       1       1       110      40       30       22       8        15  
  </code></pre>
  
  <p>What I can do:  </p>
  
  <pre><code>with T AS 
  (select type, weight from tab1 )
  select * from T
  PIVOT (
  count(type)
  for type in (A, B, C, D,E,F)
  )  
  </code></pre>
  
  <p>The above query gives me the below result  </p>
  
  <pre><code>A B C  
  2 1 1  
  </code></pre>
  
  <p>I can replace <code>count(*)</code> with <code>sum(weight)</code> or <code>sum(height)</code> to pivot height or weight. What I am looking to do, but I can't do, is pivot on all three (count, weight and height) in one query.  </p>
  
  <p>Can it be done using pivot?</p>