How to select domain name from email address

后端 未结 13 2505
半阙折子戏
半阙折子戏 2020-12-08 02:05

I have email addresses like user1@gmail.com, user2@ymail.com user3@hotmail.com ... etc. I want a Mysql SELECT that will trim user name

13条回答
  •  心在旅途
    2020-12-08 02:54

    select (SUBSTRING_INDEX(SUBSTR(email, INSTR(email, '@') + 1),'.',1) from tableName)

    Some sql statements require the table name specified where the email column belongs to.

提交回复
热议问题