title: SQL CASE statement with boolean operator
body: <p>See statement:</p>
  
  <pre><code>SELECT      t1.region, 
              Count(t1.orders) AS orders, 
              CASE t1.week 
                        WHEN &lt; '5' THEN 'APR' 
                        WHEN &lt; '10' THEN 'MAY' 
                        WHEN &lt; '14' THEN 'JUN' 
                        WHEN &lt; '19' THEN 'JUL' 
                        WHEN &lt; '23' THEN 'AUG' 
                        WHEN &lt; '27' THEN 'SEP' 
                        WHEN &lt; '32' THEN 'OCT' 
                        WHEN &lt; '36' THEN 'NOV' 
                        WHEN &lt; '40' THEN 'DEC' 
                        WHEN &lt; '45' THEN 'JAN' 
                        WHEN &lt; '49' THEN 'FEB' 
                        WHEN &lt; '53' THEN 'MAR' 
              END AS month, 
              dbo.inf_dates.months
  
  FROM        dbo.[NonVoice Weekly_InflowCOMCAN] AS t1 
  INNER JOIN  dbo.inf_dates 
                  ON t1.week = dbo.inf_dates.fin_wk
  
  WHERE       notes = 'Weekly COMPLETED'
              AND ([2MB/sub]) = 'ETH' 
              AND dbo.inf_dates.date &gt; CONVERT(datetime, '2017-04-03 00:00:00', 102)
  
  GROUP BY   t1.region 
             ,dbo.inf_dates.months 
  </code></pre>
  
  <p>As you can see I am trying to group rows with months instead of the weeks that I have in my table by creating a month column and grouping the weeks together. When I do a case statement like <code>CASE WHEN t1.Week &lt; '5' THEN 'APR'</code> I get the right results but it forces me to group by weeks which is not what I want. The two months column in the table are different by the way.</p>