Reputation: 69
Mysql database update question.
I have a table with three fields: TITLE
and PARAMS
and LEVEL
PARAMS column is a text field: {action="h3",and other information}
TITLE column is a text field: happy
I need to replace/update the h3
in the PARAMS
column with the data from the TITLE
column
So h3
will be replaced with the data in the TITLE
column.
In this example, the h3
is replaced with h4
.
UPDATE `m3o7x_menu` SET `params` = REPLACE(`params`, "h3", "h4") WHERE `level`='3';
What is the correct syntax to change h4
to the TITLE
column data?
Thanks!
Upvotes: 3
Views: 936
Reputation: 2351
try
UPDATE m3o7x_menu SET params = REPLACE(params, 'h3', 'h4') WHERE level='3';
Upvotes: 1
Reputation: 729
UPDATE m307x_menu
SET params = REPLACE(params,'h3',title) WHERE level = '3';
Upvotes: 1
Reputation: 204766
UPDATE m3o7x_menu
SET params = REPLACE(params, '"h3"', concat('"',title,'"')
WHERE level='3';
Upvotes: 1