title: SQL Server dynamic PIVOT query?
body: <p>I've been tasked with coming up with a means of translating the following data:</p>
  
  <pre><code>date        category        amount
  1/1/2012    ABC             1000.00
  2/1/2012    DEF             500.00
  2/1/2012    GHI             800.00
  2/10/2012   DEF             700.00
  3/1/2012    ABC             1100.00
  </code></pre>
  
  <p>into the following:</p>
  
  <pre><code>date        ABC             DEF             GHI
  1/1/2012    1000.00
  2/1/2012                    500.00
  2/1/2012                                    800.00
  2/10/2012                   700.00
  3/1/2012    1100.00
  </code></pre>
  
  <p>The blank spots can be NULLs or blanks, either is fine, and the categories would need to be dynamic. Another possible caveat to this is that we'll be running the query in a limited capacity, which means temp tables are out. I've tried to research and have landed on <code>PIVOT</code> but as I've never used that before I really don't understand it, despite my best efforts to figure it out. Can anyone point me in the right direction?</p>