MySQL Forums
Forum List  »  Newbie

Re: Truncate email address in username field?
Posted by: Chris Stubben
Date: June 28, 2005 08:28PM

The substring_index() function will also work. If the user name does not have a '@', it will just return the user name unchanged.



select substring_index(user_name, '@', 1) from table;

and

update table set user_name=substring_index(user_name, '@', 1);

Chris


http://dev.mysql.com/doc/mysql/en/string-functions.html

Options: ReplyQuote


Subject
Written By
Posted
Re: Truncate email address in username field?
June 28, 2005 08:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.