MySQL - Replace Character in Columns

后端 未结 4 1354
离开以前
离开以前 2020-11-29 20:08

Being a self-taught newbie, I created a large problem for myself. Before inserting data in to my database, I\'ve been converting apostrophes (\') in a string, to double quot

4条回答
  •  春和景丽
    2020-11-29 20:13

    Just running the SELECT statement will have no effect on the data. You have to use an UPDATE statement with the REPLACE to make the change occur:

    UPDATE photos
       SET caption = REPLACE(caption,'"','\'')
    

    Here is a working sample: http://sqlize.com/7FjtEyeLAh

提交回复
热议问题