I have come unstuck with a certain SQL query on a specific data set. Below is an example of the meta_value stored in the database:
a:1:{i:0;a:2:{s:11:"ingredients";a:7:{i:0;a:5:{s:6:"amount";s:1:"3";s:4:"unit";s:3:"cup";s:4:"name";s:23:"spring mix salad greens";s:5:"notes";s:0:"";s:2:"id";i:7263;}i:1;a:5:{s:6:"amount";s:1:"3";s:4:"unit";s:4:"unit";s:4:"name";s:28:"to 4 radishes, thinly sliced";s:5:"notes";s:0:"";s:2:"id";i:7264;}i:2;a:5:{s:6:"amount";s:1:"1";s:4:"unit";s:4:"unit";s:4:"name";s:60:"small orange or tangerine, peeled, seeded, and thinly sliced";s:5:"notes";s:0:"";s:2:"id";i:7265;}i:3;a:5:{s:6:"amount";s:5:"1⁄2";s:4:"unit";s:4:"unit";s:4:"name";s:46:"cucumber, scrubbed or peeled and thinly sliced";s:5:"notes";s:0:"";s:2:"id";i:7266;}i:4;a:5:{s:6:"amount";s:1:"1";s:4:"unit";s:10:"tablespoon";s:4:"name";s:9:"olive oil";s:5:"notes";s:0:"";s:2:"id";i:6785;}i:5;a:5:{s:6:"amount";s:1:"2";s:4:"unit";s:8:"teaspoon";s:4:"name";s:17:"fresh lemon juice";s:5:"notes";s:0:"";s:2:"id";i:6935;}i:6;a:5:{s:6:"amount";s:5:"1⁄2";s:4:"unit";s:8:"teaspoon";s:4:"name";s:4:"salt";s:5:"notes";s:0:"";s:2:"id";i:7215;}}s:4:"name";s:0:"";}}
I wish to replace the following portion:
s:4:"unit";s:4:"unit";
with
s:4:"unit";s:0:"";
However all my attempts completely change the entire value not just and instances of this value.
Any ideas?
I've tried the following but get the error #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''s:4:"unit")' at line 4
UPDATE
`wp_postmeta`
SET
`wprm_ingredients` =
REPLACE
(
'wprm_ingredients',
's:4:"unit";s:4:"unit";',
's:4:"unit";s:0:"";'
)