Initially, this is what we can see when I run SELECT * FROM block_custom;
:
+-----+------------------+--------+-----------+
| bid | body | info | format |
+-----+------------------+--------+-----------+
| 1 | Block1 body here | Block1 | full_html |
| 2 | Block2 body here | Block2 | full_html |
| 3 | Block3 body here | Block3 | full_html |
+-----+------------------+--------+-----------+
In order to replace info
and body
of table block_custom
, I'm using below query:
update block_custom set info = replace(info,'Block2','Block2new');
update block_custom set body = replace(body,'body here','newbody here');
This is explanation of my query:
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
When running this query to change body
, it will replace in all row of column body
.
How to make it change only in row 2 (bid 2
)?