mysql how to replace part of a string that contains quotes -
i have table field called "params" values (they different 2 names below same):
{"lots_of_stuff,"frameborder":"0",lots_of_stuff,"pageclass_sfx":"",lots_of_stuff}
i need script change "frameborder":"0" "frameborder":"1" , "pageclass_sfx":"" "pageclass_sfx":"1".
please note not fields in params have this.
you can use mysql's replace
function:
update tbl set value = replace(replace(value, 'pageclass_sfx":""', 'pageclass_sfx":"1"'), 'frameborder":"0', 'frameborder":"1')
result
| value | -------------------------------------------------------------------------------------- | {"lots_of_stuff,"frameborder":"1",lots_of_stuff,"pageclass_sfx":"1",lots_of_stuff} |
Comments
Post a Comment