Hello Forum,
I'm trying to write a query that shows me three counts of email addresses on our database, grouped by industry sector. I want a count of all email addresses, a count of primary email addresses and a count of secondary email addresses. The first count I can manage, but the other two don't group by sector, rather show the total. My query is as follows (please bear in mind that i'm a beginner, so any advice on tidying up my code or best practice tips would be appreciated):

Code:
SELECT C2.userdef06, count(*) AS all_emails,
   (SELECT count(*)
    FROM contsupp AS CS 
     INNER JOIN contact1 AS C1
      ON C1.accountno = CS.accountno
    WHERE contact = 'E-mail Address'
    AND zip LIKE '_1__%'
    AND C1.key4 IN 
      ('Cleansed','Cleanse Complet')
    ) AS p_Emails,
   (SELECT count(*)
    FROM contsupp AS CS 
     INNER JOIN contact1 AS C1
      ON C1.accountno = CS.accountno
    WHERE contact = 'E-mail Address'
    AND zip LIKE '_0__%'
    AND C1.key4 IN 
      ('Cleansed','Cleanse Complet')
    ) AS p_Emails

FROM contact1 AS C1 
 INNER JOIN contsupp AS CS 
  ON C1.accountno = CS.accountno
 INNER JOIN contact2 AS C2
  ON C1.accountno = C2.accountno

WHERE C1.key4 IN ('Cleansed','Cleanse Complet')
AND CS.contact = 'E-mail Address'
GROUP BY C2.userdef06