我想优化这条语句:
select t.xxdz from dlga_mb.code_dz t
where t.xzqhbm = 210213 and
t.jlxbm = 130206 and
t.mlphbm = 7255 and
t.dzwym not in (select t2.dzwym from m_mpdz_dzwym t2 where addressid like '210213_130206_7255%');知道吧IN改成EXISTS 但其他的就不会写了。请指教该怎么优化这条语句的好。
select t.xxdz from dlga_mb.code_dz t
where t.xzqhbm = 210213 and
t.jlxbm = 130206 and
t.mlphbm = 7255 and
t.dzwym not in (select t2.dzwym from m_mpdz_dzwym t2 where addressid like '210213_130206_7255%');知道吧IN改成EXISTS 但其他的就不会写了。请指教该怎么优化这条语句的好。
where
t.dzwym= t2.dzwym(+) and
t2.addressid like '210213_130206_7255%' and
te.dzwym is null and
t.xzqhbm = 210213 and
t.jlxbm = 130206 and
t.mlphbm = 7255
where t.xzqhbm = 210213 and
t.jlxbm = 130206 and
t.mlphbm = 7255 and
not exists(select 1 from m_mpdz_dzwym t2 where
t2.dzwym= t.dzwym and addressid like '210213_130206_7255%');
where t.xzqhbm = 210213 and
t.jlxbm = 130206 and
t.mlphbm = 7255 and
not exists (select 1 from m_mpdz_dzwym t2 where
addressid like '210213_130206_7255%' and t.dzwym = t2.dzwym)