title: using CASE in the WHERE clause
body: <p>simplified version of my query</p>
  
  <pre><code>SELECT *
  FROM logs 
  WHERE pw='correct' AND CASE WHEN id&lt;800 THEN success=1 ELSE END 
  AND YEAR(timestamp)=2011 
  </code></pre>
  
  <p>this doesn't work. What i'm trying to do is to add in <code>success=1</code> only for rows with <code>id&lt;800</code>, else ignore this check.</p>
  
  <p>how do i write this? thanks!</p>
  
  <p>edit: to clarify, this what the table looks like</p>
  
  <pre><code>|id  | pw      | success |
  --------------------------
  |700 | correct | 1       |
  |710 | correct | 1       |
  |900 | correct | NULL    |
  |999 | correct | 0       |
  </code></pre>
  
  <p>I'm trying to return all the rows, the column <code>pw</code> cannot be ignored.</p>