Skip to content

Instantly share code, notes, and snippets.

@betawax
Created August 10, 2011 13:55
Show Gist options
  • Save betawax/1136849 to your computer and use it in GitHub Desktop.
Save betawax/1136849 to your computer and use it in GitHub Desktop.
Get the most used domains of email addresses
SELECT SUBSTRING_INDEX(email, '@', -1) AS domain, COUNT(SUBSTRING_INDEX(email, '@', -1)) AS count FROM table GROUP BY domain ORDER BY count DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment