ORACLE中嵌套子表查询
T3={T1 -> T2}
T3 ->T4
select T3.PCKLSTNO,T3.PACKQTY,sum(nvl(T4.PLANQTY,0)) PLQTY FROM
(select T1.PCKLSTNO,sum(nvl(T2.PACKQTY,0)) PACKQTY
from IMTBCTNPKL T1
left join IMTBSHPACK T2 on T1.PCKLSTNO=T2.PCKLSTNO and T1.CTNID=T2.CTNID
where T1.CTNID IN (select distinct CTNID from IMTBCTNPKL where PCKLSTNO like '%' || :PCKLSTNO || '%')
group by T1.PCKLSTNO
) T3
left join IMTBPKLSTD T4 on T3.PCKLSTNO=T4.PCKLSTNO
group by T3.PCKLSTNO,T3.PACKQTY