MySQL8 使用Like更新字段包含 \, 需要使用\\\\ 进行转义查询

待变更数据记录集合:

需要将\f4 字段替换为e1

查询SQL语句:

1、查询符合条件的数据总数:

select pdf_path from ucas_file_info where ucas_file_info.pdf_path like '\\\\f4%';

2、批量替换\f4 替换为e1


update ucas_file_info set ucas_file_info.pdf_path = replace(ucas_file_info.pdf_path, '\\f4', 'e1') where ucas_file_info.pdf_path like '\\\\f4%';

猜你喜欢

转载自blog.csdn.net/zhouzhiwengang/article/details/114289358