I have a table containing email addresses and account numbers (amongst other data).
I have removed the other data for simplification.
The inner query (
q) will count how many distinct email addresses each account has. The outer query will then count how many accounts fall into each counting bucket (1, 2, 3, ...).
SELECT q.email_counter, COUNT(*) AS num_accounts FROM (SELECT account_number, COUNT(DISTINCT email_address) AS email_counter FROM YourTable GROUP BY account_number) q GROUP BY q.email_counter;