开发者

MySQL select of everything before @

I want to select out the part of an email address column before @. So if a row is somebody@somewhere.com, how do I select somebody out of each row?开发者_开发知识库

Thanks!


select substring_index('somebody@somewhere.com', '@', 1);

doc -- http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_substring-index


SELECT SUBSTRING_INDEX(email, '@', 1) AS emailname FROM table;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜