title: T Sql Case use between in case when with where clause
body: <p>Trying to do a <code>WHERE BETWEEN</code> with a <code>CASE WHEN</code>:</p>
  
  <pre><code>SET @Qtr1 = datepart(MONTH,@dt1)
  select 
  SUM(QtyInvoiced) as QtrCase
  ,CustName
  ,Town
  ,Rep
  from SalesSumNew 
  where
  FinMonth between
  case when @Qtr1 between '1' and '3' THEN '10' and '12'
  ,case when @Qtr1 between '4' and '6' THEN '1' and '3'
  ,case when @Qtr1 between '7' and '9' THEN '4' and '6'
  ,case when @Qtr1 between '10' and '12' THEN '7' and '9'
  end
  group by CustName, Town, Rep
  order by Town
  </code></pre>
  
  <p>Results in error:</p>
  
  <blockquote>
    <p><em>Msg 156, Level 15, State 1, Line 57<br>
    Incorrect syntax near the keyword 'and'.</em></p>
  </blockquote>