Count Email Address Domains
Posted
by BRADINO
on Bradino
See other posts from Bradino
or by BRADINO
Published on Wed, 15 Jul 2009 01:03:16 +0000
Indexed on
2010/03/23
5:22 UTC
Read the original article
Hit count: 822
mysql
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.
© Bradino or respective owner