title: Select records between values of two columns
body: <p>I have following table which saves sales data for specific week of a year.</p>
  
  <p><strong>Sales</strong></p>
  
  <pre><code>week | year | value
  50   | 2011 | 150
  51   | 2011 | 151
  52   | 2011 | 152
  1    | 2012 | 170
  2    | 2012 | 190
  3    | 2012 | 180
  4    | 2012 | 160
  5    | 2012 | 170
  6    | 2012 | 290
  </code></pre>
  
  <p>I want to find records which lies between week1 of year1 and week2 of year2.</p>
  
  <p>for example</p>
  
  <ol>
  <li>between week 50 of 2011 to week 5 of 2012 </li>
  <li>between week 1 of 2012 to week 6 of 2012</li>
  </ol>
  
  <p>Having little experience in sQL, I tried following query which works for case 2 but not for case 1.</p>
  
  <pre><code>SELECT * from sales WHERE (week &gt;= 1 AND year &gt;= 2012) AND (week &lt;= 6 AND year &lt;= 2012 ) 
  </code></pre>
  
  <p>Looks like grouping of condition does not work as I understand. It takes as if there are no grouping of conditions.</p>