title: Dynamic pivot table with two id columns
body: <p>This is probably simple but I"m just not seeing it.  Your help is appreciated.  I have a table in MS SQLServer that looks like this</p>
  
  <pre><code>CustomerID     Time                         ItemID
  1              2008-10-07 06:32:53:00.000    87432
  1              2008-10-07 06:32:53:00.000    26413
  2              2010-06-23 03:45:10:00.000    6312
  2              2011-09-14 07:36:03:00.000    87432
  2              2011-09-14 07:36:03:00.000    87432
  </code></pre>
  
  <p>I want to end up with a table that has each customer, the timestamp and the count of the items purchased during that timestamp, that looks like this</p>
  
  <pre><code>CustomerID    Time                         87432  26413   6312
  1             2008-10-07 06:32:53:00.000    1       1       0
  2             2010-06-23 03:45:10:00.000    0       0       1
  2             2011-09-14 07:36:03:00.000    2       0       0
  </code></pre>
  
  <p>In the source table, the time and itemID are variable (and plentiful), so I'm thinking a dynamic pivot will do the trick.  Is this possible to do with pivot? If so, how?</p>