title: SQL QUERY to display NULL values when using COUNT
body: <p>I need to produce the number of healthclub members that are enrolled through their employer(several different employers not just 1) for a monthly membership and what level of membership they have plus their family members. The problem I am having is that currently we do not have any LEVEL D membership but may in the future.  I need the report to display ‘0’ when there is no membership. I tried </p>
  
  <pre><code>COUNT(DISTINCT CUSTOMER_ID) + 
    COUNT(CASE WHEN CUSTOMER_ID IS NULL THEN 1 END) AS NUMBER_OF_CUSTOMERS  
  </code></pre>
  
  <p>And it did not work, any help is appreciated.</p>
  
  <pre><code>SELECT
      MEMBERSHIP_TYPE,
      COUNT(DISTINCT CUSTOMER_ID) AS NUMBER_OF_CUSTOMERS,
      COUNT(CASE WHEN CUSTOMER_RELATION = ‘FAMILYMEMBER’ THEN 1 END) AS FAMILY_MEMBERS,
      COUNT(DISTINCT CUSTOMER_ID) + COUNT(CASE WHEN CUSTOMER_RELATION    ‘FAMILY_MEMBERS’ THEN 1 END) AS TOTAL
  </code></pre>
  
  <p>This is what I currently get</p>
  
  <pre><code>MEMBERSHIP_TYPE  NUMBER_OF_CUSTOMERS    FAMILY_MEMBERS  TOTAL
  -------------------------------------------------------------
  LEVEL A                 100                  25           125
  LEVEL B                 630                 340           970
  LEVEL C                1201                 630          1831
  </code></pre>
  
  <p>I need this </p>
  
  <pre><code>MEMBERSHIP_TYPE  NUMBER_OF_CUSTOMERS    FAMILY_MEMBERS  TOTAL
  -------------------------------------------------------------
  LEVEL A                 100                  25           125
  LEVEL B                 630                 340           970
  LEVEL C                1201                 630          1831
  LEVEL D                   0                   0             0
  </code></pre>