title: I want to do "ORDER BY" before "WHERE" in SQL
body: <pre><code>SELECT card_id from logs
  WHERE card_id in ('0001', '0002')
  ORDER BY date desc limit 1
  </code></pre>
  
  <p>This code first selects the values that matches the list and then chooses the last row.
  How can I first choose the last row from card_id and look if it matches any value in the list</p>