方法一:
UPDATE
yiyao_prs.prs_image_detail
LEFT JOIN
yiyao_prs.prs_prescription_app
ON
prs_image_detail.IMAGE_ID = prs_prescription_app.IMAGE_ID
SET
IS_MAIN='1'
WHERE
prs_prescription_app.SOURCE IN ('6','7','8','12')
更新更新app上传的图片 使用连接方式,性能如下
方法二
UPDATE yiyao_prs.prs_image_detail
SET IS_MAIN = '1'
WHERE
IMAGE_ID IN (
SELECT
a.IMAGE_ID
FROM
yiyao_prs.prs_prescription_app a
WHERE
a.SOURCE IN ('6', '7', '8', '12')
)
性能如下
推荐使用方法一进行多表更新
来源:oschina
链接:https://my.oschina.net/u/1790478/blog/710112