title: How best to Count(*) with a CASE STATEMENT?
body: <p>The following SQL (on SQL Server) returns an error of: </p>
  
  <blockquote>
    <p>Incorrect syntax near '*'</p>
  </blockquote>
  
  <p>Is there something inherently wrong with using the following SELECT statement?:</p>
  
  <pre><code>SELECT
  COUNT(CASE WHEN &lt;conditions&gt; THEN * ELSE NULL END) as conditionalcountall
  FROM TABLE
  </code></pre>
  
  <p>I tried this variation which also failed:</p>
  
  <pre><code>SELECT
  CASE WHEN &lt;conditions&gt; THEN COUNT(*) ELSE NULL END as conditionalcountall
  FROM TABLE
  </code></pre>