简体   繁体   中英

mysql Opposite of SUBSTRING_INDEX

I can select the text string before the @ character:

sample entry in DB: email@domain.com , sample output: email

with:

SELECT SUBSTRING_INDEX(email,'@',1)

but what is the command for selecting text string after the @ character ?

Thank you

Use a negative value for count like this:

SELECT SUBSTRING_INDEX(email,'@',-1)

See the documentation here:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM