Created
March 28, 2011 00:25
-
-
Save elidickinson/889806 to your computer and use it in GitHub Desktop.
MySQL extract domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
user name SELECT MID(comment_author_email,1,LOCATE('@',comment_author_email)-1) AS u FROM comments;