兩表關聯更新數據——oracle

update testa a set(name, remark)=(select b.name, b.remark from testb b where b.id=a.id)   where exists(select 1 from testb b where b.id=a.id)  ;

 

(where exists(select 1 from testb b where b.id=a.id):若是沒有這個條件,不匹配的選項也會被更新。spa

相關文章
相關標籤/搜索