修改数据 update where里的条件是别的表

比如,如果B表中有满足条件的数据,才修改A的表:

update A set col1 = xxx where exists(select 1 from B where b.col2 = 'yyy');

或者两表关联:

update A set col1 = xxx where exists(select 1 from B where b.col2 = 'yyy' and b.col1 = a.col1);
 
原文地址:https://www.cnblogs.com/javalinux/p/15787406.html