Maison > Article > développement back-end > 怎么替换MYSQL中某字段的内容,参数替换
比如内容是
*********.php?haode=yes********789**********
*********.php?haode=yes********246**********
*********.php?haode=yes********221**********
*********.php?haode=yes********687**********
*********.php?haode=yes********215**********
*********.php?type=789********789**********
*********.php?type=246********246**********
*********.php?type=221********221**********
*********.php?type=687********687**********
*********.php?type=215********215**********
?abc替??1,2,3
update table set fields = REPLACE(fields, 'abc', '123');
?abc替??1,2,3
update table set fields = REPLACE(fields, 'abc', '123');
update tbl_name set field=REPLACE(field, 'haode=yes', CONCAT('type=', SUBSTRING_INDEX(SUBSTRING_INDEX(field, '</b>', 1), '<b>', -1))
update tbl_name set field=REPLACE(field, 'haode=yes', CONCAT('type=', SUBSTRING_INDEX(SUBSTRING_INDEX(field, '</b>', 1), '<b>', -1))
.... , -1)) )
少粘了一层括号
update tbl_name set field=REPLACE(field, 'haode=yes', CONCAT('type=', SUBSTRING_INDEX(SUBSTRING_INDEX(field, '</b>', 1), '<b>', -1))
.... , -1)) )
少粘了一层括号