title: How to use SQL Server Pivot with multiple criteria
body: <p>I have a table like below, that I would like transpose rows to colums, but I want to have columns for each month_product. </p>
  
  <p>I know I could use SUM(CASE) for each product type and month like:</p>
  
  <pre><code>  SUM(CASE WHEN Month='July' AND Product='Prod1'THEN Revenue END) 
  </code></pre>
  
  <p>However I would like to use pivot (I heard it's more efficient). I've been looking  arond how to use pivot, but the only ones I seem to be able to find is how to simply move the rows to columns, not combine rows to a column.</p>
  
  <p>Could someone let me know whether this is possible or I have to stick with the good old case when method.</p>
  
  <p>thanks,</p>
  
  <p>from:</p>
  
  <pre><code>------------------------------------------------
  |Month| Account| Product| Revenue|
  ------------------------------------------------
  | July| Acct1  | Prod1  |1000
  ------------------------------------------------
  | July| Acct1  | Prod2  |1000
  ------------------------------------------------
  | Aug| Acct2   | Prod2  |1000
  ------------------------------------------------
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>------------------------------------------------
  |Account  | July_Prod1| July_Prod2| Aug_Prod2
  ------------------------------------------------
  | Acct1   |     1000  |   1000    |
  ------------------------------------------------
  | Acct2   |     -     |   -       |   1000
  ------------------------------------------------
  </code></pre>