Reputation: 13
So I have a bunch of users in a column that get refreshed as:
[email protected]
[email protected]
[email protected]
We refresh the database each week and I need to update these appropriate emails to:
[email protected]
[email protected]
[email protected]
I figured I can use concat to do the latter, but I am stuck on the former issue. Is there a way to split the values (like split [email protected] into Bill - @test.comXYZ and then remove the @TEXT values?).
Anyways, any help will be much appreciated.
Upvotes: 1
Views: 890
Reputation: 28217
You can use the mySQL replace function, i.e.
UPDATE mytable
set myfield = replace (myfield, '@test.comXYZ', 'domain.com')
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
Upvotes: 1