title: SQL - Why is my percentage aggregation blank?
body: <p>I'm trying to get <strong>percentage</strong> of issues that are marked as <strong>closed</strong>, for some reason it's coming out as 0 for all entries.</p>
  <p>Any idea what I could be doing wrong?</p>
  <pre><code>SELECT
      CASE
          WHEN COUNT(IF(progress = 'CLOSED', id)) = 0 THEN 0
          ELSE 1.0 * (COUNT(IF(progress = 'CLOSED', id)) / COUNT())
      END as pct_closed,
      assigned_date
  FROM table
  WHERE assigned_date &gt;= YYYY-MM-DD
  GROUP BY 2
  </code></pre>