MySQL关联多表更新的操作

单表更新:

update table1 set columns1=1,cloumns2=2 where condition1 and condition2

多表关联更新:

# 多表更新
update table1 t1,table2 t2 set t1.columns1=1,t2.columns1=1 where t1.id=t2.id and condition1 and condition2
# 左联更新
update table1 t1 left join table2 t2 on t1.id = t2.id set t1.columns=1,t2.columns=1 where condition1 and condition2
本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!