Skip to content

Instantly share code, notes, and snippets.

@elidickinson
Created March 28, 2011 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elidickinson/889806 to your computer and use it in GitHub Desktop.
Save elidickinson/889806 to your computer and use it in GitHub Desktop.
MySQL extract domain
# domain from email address
SELECT mid(email from locate('@',email)+1) as domain FROM emails;
# domain from URL (hacky)
SELECT MID(url,8,LOCATE('/',url,8)-8) AS domain FROM clicks
@elidickinson
Copy link
Author

user name SELECT MID(comment_author_email,1,LOCATE('@',comment_author_email)-1) AS u FROM comments;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment