title: Using a CASE statement in the WHERE clause
body: <p>I've been looking through other questions and couldn't find one like my specific situation.</p>
  
  <p>I need some way to do conditional statements in my <code>WHERE</code> clause like the following:</p>
  
  <p>If field dqpoln isn't 0, I need to add that comparison " AND dqpoln=mppoln ". </p>
  
  <pre><code>   " SELECT ... "
     " FROM ... "
     " WHERE ((dqtype=@userType AND dqssn=@userSSN) OR (dqtype=a.maagtt AND dqssn=a.maassn)) " &amp;
     " CASE dqpoln WHEN 0 THEN '' ELSE  AND dqpoln=mppoln  END "
  </code></pre>
  
  <p>I've tried using a <code>CASE</code> statement a few different ways and tried some IF statements as well. Nothing seems to work for me.</p>