title: How to make a case when better in sql
body: <p>I have a <code>stored procedure</code> in which I have 2 variables</p>
  
  <pre><code>Declare @from int
  Declare @to int
  </code></pre>
  
  <p>This variables will give the month from and to for a math calculation.</p>
  
  <p>My table is like this:</p>
  
  <p>Sum1 / Sum2 / Sum3 / Sum4 / Sum5 / Sum6 / Sum7 / Sum8 / Sum9 / Sum 10 / Sum 11 / Sum 12 / GroupByID</p>
  
  <p>And I have calculation in my SQL like this:</p>
  
  <pre><code>Select SUM( SUM1) + SUm(Sum2) + .... + Sum(Sum12) from Table group by GroupByID
  </code></pre>
  
  <p>Now I only want the <code>Sum(month)</code> of a month which is given by the <code>parameters</code>, how to do this?</p>