MySQL中,怎样将A表修改字段内的内容再更新到B表

图片说明

图中为A表的内容,表A中tofile字段里将每条数据前面“/uploads/allimg/c140320”替换成“/image”,后面文件名保持不变,最后再更新到B表中tofile字段;表A中tofile字段每条数据前面“/image”,就整个数据不修改更新到B表中的tofile字段中。

具体要怎么做?求详细过程或sql语句。

update tableb b
inner join tablea a on b.column=a.column
set b.tofile=replace(a.tofile,'/uploads/allimg/c140320','/image')
where a.ofile like '/uploads/allimg/c140320%';

参考自:
mysql多表更新(跨表更新) http://www.data.5helpyou.com/article252.html