 <pre><code>SELECT a.STATE , COALESCE(b.count, 0) AS Count FROM ( SELECT 'done' AS STATE UNION SELECT 'open' AS STATE UNION SELECT 'pending' AS STATE UNION SELECT 'draft' AS STATE UNION SELECT 'cancel' AS STATE ) a LEFT JOIN ( SELECT STATE , count(*) AS count FROM crm_lead GROUP BY STATE ) b ON a.STATE = b.STATE </code></pre>