title: Conditional sum in Group By query MSSQL
body: <p>I have a table OrderDetails with the following schema:</p>
  
  <pre><code>----------------------------------------------------------------
  |  OrderId  |  CopyCost  |  FullPrice  |  Price  |  PriceType  |
  ----------------------------------------------------------------
  |  16       |  50        |  100        |  50     |  CopyCost   |
  ----------------------------------------------------------------
  |  16       |  50        |  100        |  100    |  FullPrice  |
  ----------------------------------------------------------------
  |  16       |  50        |  100        |  50     |  CopyCost   |
  ----------------------------------------------------------------
  |  16       |  50        |  100        |  50     |  CopyCost   |
  ----------------------------------------------------------------
  </code></pre>
  
  <p>I need a query that will surmise the above table into a new table with the following schema:</p>
  
  <pre><code>----------------------------------------------------------------
  |  OrderId  |  ItemCount  |  TotalCopyCost  |  TotalFullPrice  |
  ----------------------------------------------------------------
  |  16       |  4          |  150            |  100             |
  ----------------------------------------------------------------
  </code></pre>
  
  <p>Currently I am using a Group By on the Order.Id to the the item count. But I do not know how to conditionally surmise the CopyCost and FullPrice values. </p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Regards
  Freddie</p>