Oracle sql优化问题update tableA set ind='Y' where id in (select id from tableB)update tableA set ind='N' where id not in (select id from tableB)怎么合并为1条sql提高效率?
并不是合并了就能提高效率其实你现在效率低无非就是查询了2遍tableB,你可以先用个变量把结果存下来(临时表)然后下面两个括号里用变量代替,这样就只查询一次了