通过 LEFT join 实现更改表A中的create_by 当表A 的business_id 等于B的id 且表A的名字 like publish
方法一
update 表A a LEFT join
表B b on a.business_id=b.id set a.create_by=b.create_by
where
a.name like 'publish%'
方法二
UPDATE 表A a ,表B b SET a.create_by = b.create_by WHERE a.business_id = b.id AND a.name like 'publish%'
MSSQL 的联查更新语法如下(在mysql 中报错)
update A
set A_NAME = B.B_NAME
from A left join B
ON
A.B_ID = B.B_ID