好像是
一条update只能修改一张表里的字段,但是可以关联多张表去修改。不知道你用的是什么数据库。
常用的sqlserver格式如下:
update table1 set a.字段1=b.字段1,....,a.字段N=b.字段N from table1 a,table2 b where 两个表的关联字段。
常用的oracle格式如下:
update table1 a set (a.字段1,....,a.字段N) =(select b.字段1,...,b.字段N from table2 b where 两个表的关联字段) where exists (select 1 from table2 b where 两个表的关联字段)。
注意oracle语句里的exists不能省略,否则会导致没有对应关系的数据修改错误,甚至会报错。