Last active
October 14, 2016 16:32
-
-
Save arodbits/f1fcfed9a5c70c7fb2c4dc8f138ea16c to your computer and use it in GitHub Desktop.
Update a field value on a MYSQL table by using a conditional subquery. Replace the occurrence of a character with a new one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- update any occurrence of a quote character from a string in mysql | |
update site_user as original | |
join (select site_user.id, replace(site_user.email, "\"", "") as new_email from site_user where email like "%\"%") as conditional | |
on original.id = conditional.id | |
set original.email = conditional.new_email; | |
--follow me on twitter: www.twitter.com/anthonyrod4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment