title: How to use a Case Statement to Include or Exclude Data in SQL
body: <p>I have a check box on an HTML page that I want to use to determine what group of employees should be included or excluded from a report. So far I can only get the query to include ALL employees regardless of status if the check box is NOT checked or to show ONLY retired employees if the checkbox IS checked. ('' is the check box)</p>
  
  <pre><code>SELECT USERS.UserName AS "Last_Name", USERS.UserName_First AS "First_Name", 
  USERS.Retired AS "Retired"
  FROM   Employee USERS
  WHERE   
  USERS.Retired IS NULL OR USERS.Retired = '&lt;$client.form.retired&gt;'
  ORDER BY isnull(USERS.Retired , 0)
  </code></pre>
  
  <p>The way I want this to work is if the checkbox is CHECKED to include Retired Employees along with Active employees and to order by the Retired status.
  But if the check box is NOT checked I ONLY want it to show Active employees and to completely leave out Retired employees on the report- its doing the opposite of this.
  (A side issue is that the column would be a random blank column but not sure I can do anything about that at all).  </p>
  
  <p>How do I use a Case statement to achieve this in the WHERE clause?</p>