Count Email Address Domains
A quick tidbit I came up with today to count email addresses in a mysql database table grouping them by domain. So say for example you have a large list of subscribers and you want to see the breakdown of people who use Hotmail, Yahoo, Gmail, etc.
SUBSTRING_INDEX( `email` , '@', -1 ) AS `domain`
FROM `subscribers` WHERE `email` != ''
GROUP BY `domain`
ORDER BY `count` DESC
This sql statement assumes that the table is called 'subscribers' and the column containing the email addresses is 'email'. Change these two values to match your table name and email address column name.
You’re currently reading “ Count Email Address Domains ,” an entry on BRADINO
- Published:
- 7.14.09 / 9pm
- Category:
- MySQL























This is very helpful. Thanks for posting it.