Log in

View Full Version : [Help] Query to replace just one character...


Fridgecritter
08-02-2017, 11:25 AM
I've been in the mysql docs online and asked a few people, but can't seem to get this right running it on my sample database. But I know one of you is a wiz at this and knows the answer off the top of your head.

I need to run a query on the items database, in the name field, that changes all of the apostrophes (') to acute accents (`). I tried RNAME and NAME LIKE, but I am getting my syntax wrong somewhere.

Maybe: UPDATE items SET name = (REPLACE(caption,''','`''));

But I know something's wrong with my formatting.

Thanks a ton in advance.

Fridgecritter
08-02-2017, 11:36 AM
Tried UPDATE items SET name = REPLACE(name,''','`');

Didn't work either.

Fridgecritter
08-02-2017, 12:03 PM
SOLVED

I was using ' ' instead of quotation marks to designate the character to replace (" "). Here is the query I ran on the database to replace all of the apostrophes with acute accents:

UPDATE items SET name = REPLACE(name,"'","`");