I MySQL <8.0, där regexp_replace()
och liknande stöds inte, du kan använda strängfunktioner:
update wp_comments
set comment_content = concat(
substr(comment_content, 1, locate('XXX', comment_content) - 1),
'MMM',
substr(comment_content, locate('XXX', comment_content) + 3)
)
where comment_id = 334 and locate('XXX', comment_content) > 0
comment_id | comment_content ---------: | :----------------------------------------------------------------------------- 334 | Hello MMM tomorrow we XXX will meeting in XXX Dubai, Do you want join us XXX ?