Skip to content

Instantly share code, notes, and snippets.

@vindia
Last active December 19, 2015 22:59
Show Gist options
  • Save vindia/6031747 to your computer and use it in GitHub Desktop.
Save vindia/6031747 to your computer and use it in GitHub Desktop.
Select domain name from an email field in MySQL
SELECT email,
RIGHT(email, LENGTH(email) - LOCATE('@', email)) as domain
FROM `table`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment