I have a database where I need to run sql scripts in order to export the new data from a 3rd party. The data then would also need to be cleaned by which I am doing via MySQL workbench. I am currently stuck at the part where I need to clean the strings containing a combination of a backslash and apostrophe together.
For example,
June\'s Wedding
I want the string to be
June's Wedding
So first I will be searching for such strings right? So I queried
SELECT columnname FROM tablename WHERE columnname LIKE '%\\\\''%'
to see whether my REPLACE()
will work or not before I proceed to UPDATE
I change the query to this
SELECT REPLACE(columnname,'\'','''') FROM tablename WHERE columnname LIKE '%\\\\''%'
but there is no changes applied to the string as it remains
| REPLACE(columnname,'\'','''')|
+------------------------------+
| June\'s Wedding |
How do I resolve this?
Also I am abit confused with the escape characters such as do I need to use the double single-quote ''
in REPLACE()
or use \'
?