–not in 优化
select RIGHT(MATNR,11) as MATNR,QUNTY,PLNMG,ERDAT from
(select MATNR,QUNTY,PLNMG,ERDAT from ZZMAST
union all
select MATNR,QUNTY,PLNMG,ERDAT from ZMANT t1
–where MATNR NOT IN (SELECT MATNR from ZZMAST)
where not exists (select t1.MATNR,t1.QUNTY,t1.PLNMG,t1.ERDAT from ZZMAST t2 where t1.MATNR=t2.MATNR)
) as a
WHERE ISNUMERIC(MATNR)=1