举个栗子一:
批量删除某个内容前的所有内容 例:删除表wp_posts 字段post_content 内容里所有href前的内容
1 |
update wp_posts set post_content = substr(post_content,locate('href',post_content)) where post_content is not null and locate('href',post_content)>=1 |
举个栗子二:
批量删除某个内容后面的所有内容 例:删除表wp_posts 字段post_content 内容里所有.pdf后的内容
1 |
update wp_posts set post_content = LEFT(post_content, INSTR(post_content, '.pdf') - 1) where post_content like '%.pdf%'; |