I would like to update a part of string in a particular column of my database.
I have cm2 in the particular column of my database and would like to update it to cm2.
My sql query to find the cm2 is:
SELECT *
FROM `question_table`
WHERE `option` LIKE '%cm2%'
To update I want to try is this:
Update question_table.option
set Value = replace(value,'cm2','cm<sup>2</sup>').
Not sure whether this is correct. Need some guidance on this.
EDIT:
Syntax:
UPDATE question_table SET option = Replace(option, 'cm2','cm<sup>2</sup>')
WHERE option LIKE '%cm2%'
It throws me an error as:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option = Replace(option, 'cm2','cm<sup>2</sup>') WHERE option LIKE '%cm2%'' at line 1