MySQL replaces the UPDATE statement for part of a field
- 2020-05-15 02:24:05
- OfStack
To replace part of a field, use the update statement:
UPDATE table name SET field name = REPLACE(before replacing the field value, 'before replacing the keyword ',' after replacing the keyword ') WHERE field name REGEXP "before replacing the field value ";
For example, this method is used to replace the product price in the title
UPDATE table name SET field name = REPLACE(before replacing the field value, 'before replacing the keyword ',' after replacing the keyword ') WHERE field name REGEXP "before replacing the field value ";
For example, this method is used to replace the product price in the title
UPDATE dede_archives SET title= REPLACE( title, 155, 170 );
UPDATE dede_archives SET title= REPLACE( title, 180, 230 );
UPDATE dede_archives SET title= REPLACE( title, 270, 350 );
UPDATE dede_archives SET title= REPLACE( title, 210, 170 );
UPDATE dede_archives SET title= REPLACE( title, 155, 170 );