------解决方案-------------------- update table1 t1 set (t1.bbb,t1.ccc)=(select t2.bbb2,t2.bbb2 from table2 t2 where (t2.id2=t1.id1 and t2.aaa=t2.aaa) where t1.id1=t2.id2 and t1.aaa=t2.aaa;
------解决方案--------------------
------解决方案--------------------
------解决方案-------------------- update table1 set bbb=(select bbb2 from table2 where table1.id=table2.id and table1.aaa=table2.aaa) --这个是更新数据用的
where exists(select null from table2 where table1.id=table2.id and table1.aaa=table2.aaa) --如果没有这个 那 些table1表中不符合where table1.id=table2.id and table1.aaa=table2.aaa这个条件的语句将会被更新为null 你可以测试下