我的github

 

 https://blog.csdn.net/dietime1943/article/details/72742651

错误的做法:

update 表1

set 表1.字段=

(SELECT
表2.字段
FROM
表2 where 表2.ID = 表1.ID)

后面这种情况其实可以使用left join的方式来实现嘛

update 表名1 
    set 表名1.xx=表名2.xx 
from 表名1 left join 表名2 
    on 表名1.关联字段1=表名2.关联字段2;

https://blog.csdn.net/weixin_40364882/article/details/115985493

posted on 2021-04-22 17:11  XiaoNiuFeiTian  阅读(500)  评论(0)    收藏  举报