update test set set b=select b1 from temp where test.id=temp.id); 给你举了个例子,id是这两个表都有的连接字段,而且对同一个id。查询select * FROM TEST,TEMP where test.id=temp.id 仅返回一条
实际上是语法错误。 同时更新多个字段,不是使用and连接,而是使用','逗号隔开。 所以,你这个语句的正确写法是,把and改成, update set table1 fir set fir.a=(select name from table2 sec where fir.id_1=sec.id) , fir.b=(select name from table2 sec where fir.id_2=sec.id);