title: Querying total number of rows with a number present
body: <p>I am using Microsoft Access to query a table named "AllData" which contains a column "gender".</p>
  
  <p>The gender column has data that is a number type, the number in this column is either 1 (male), 2 (female), 3 (other), or null.</p>
  
  <p>I want to count how many males there are. I tried using the answers to this previous question <a href="https://stackoverflow.com/questions/1400078/is-it-possible-to-specify-condition-in-count">Is it possible to specify a condition in Count()</a>. This is my best attempt at using the information from the top answer:</p>
  
  <pre><code>SELECT
  
  COUNT(CASE gender WHEN 1 THEN 1 ELSE NULL END)
  
  FROM AllData;
  </code></pre>
  
  <p>But when I run this query I get an error message "Syntax error (missing operator) in query expression 'COUNT(CASE gender WHEN 1 THEN 1 ELSE NULL END)'. I am very new to SQL and so I cannot figure out which part of that line might be leading to the problem.</p>