title: SQL How to Combine Multiple Fields with Case and Sum Statements
body: <p>I am trying to aggregate my data by first renaming multiple data points as a similar name, and summing the quantities for those.  I have tried the following:</p>
  <pre><code>select  CASE
  when Category='1' or Category='2' Then 'TEST'
  when Category='3' Then 'ACTUAL' 
  else category end As Activity, 
  sum(case when quantity &gt;0 then quantity end) from DataBase 
  Group By category
  </code></pre>
  <p>The output is this:</p>
  <pre><code>Activity   |  Quantity  
    Test     |    8  
    Actual   |    20  
    Test     |    2  
  </code></pre>
  <p>However, I want it to look like this:</p>
  <pre><code>Activity   |  Quantity  
  Test       |  10  
  Actual     |  20 
  </code></pre>