title: SQL filtering by different conditions based on values in column
body: <p>I have a classifier column that can have value of X or Y. My select query has to filter by date taking into account if the column has x or y. </p>
  
  <pre><code>date BETWEEN i.valid_fromX AND i.valid_toX 
  date BETWEEN i.valid_fromY AND i.valid_toY 
  </code></pre>
  
  <p>Essentially I need the equivalent of the following in SQL:</p>
  
  <pre><code>if classifier == X {
    check if date is between valid_fromX to valid_toX
  }   else if classifier == Y {
    check if date is between valid_fromY to valid_toY
  }
  </code></pre>