title: Accomplish pivot in teradata sql
body: <p>Say I have a query that returns values like this:</p>
  
  <pre><code>id    type     value
  aaa   1a        10
  aaa   1b        20
  aaa   1c        7
  bbb   2a        10
  bbb   1a        5
  </code></pre>
  
  <p>There are > 50 million rows and 240 possible "types".  I want to make a pivot where there is one row for each <code>id</code> and each <code>type</code> is it's own column:</p>
  
  <pre><code>id   1a   1b   1c   2a
  aaa  10   20   7    
  bbb  5              10
  </code></pre>
  
  <p>I can do this in SQL server but I don't know how to do it in Teradata.  There are too many columns for me to make CASE statements.  However, each distinct <code>type</code> is in a table field, if that's any help.</p>