April 5th, 2013, 02:03 PM
Help with email address group by query
running mysql 5.5 and I have a table with email address and I need to compile a list of email address grouped by whatever is in front of the @ descending by count.
such as :
the field name in the table is of course 'email' any help would be appreciated
thanks in advance.
April 5th, 2013, 03:14 PM
after some research I came up with this....to get the top 10,000
SELECT substring_index(email, '@', 1), COUNT(*) AS MyCount FROM mytable GROUP BY substring_index(email, '@', 1) ORDER BY MyCount DESC limit 10000;