mysql 链接表更新

方法一:


UPDATE T1, T2
SET T1.c2 = T2.c2,
T2.c3 = expr
WHERE T1.c1 = T2.c1 AND condition

方法二(上面的update多表,其实和下面的update join是一致的。):
UPDATE T1,T2
INNER JOIN T2 ON T1.C1 = T2.C1
SET T1.C2 = T2.C2,
T2.C3 = expr
WHERE condition

赞 (0)
分享到:更多 ()