在下面的查询 c.EXTRA_CALLOFF_FLAG = a.EXTRA_CALLOFF_FLAG 它有两个匹配项,一个是 Y,另一个值为 NULL
SELECT PICKUP_WK_NBR,REGION_CD,GLOBAL_DUNS_NBR,GLOBAL_SUPPLIER_NAME,a.EXTRA_CALLOFF_FLAG,
nvl((SELECT sum(c.CALLOFF_QTY)
FROM GMMT_OWNER.OR_SA_ATTAIN_DTL_T c join GMMT_OWNER.OR_SA_INCOTERMS_T d
on
c.SUPPLIER_INCOTERMS_1_CD = d.INCOTERMS_CD
WHERE
d.PICKUP_ARRIVAL_FLAG='P' and
a.PICKUP_WK_NBR = c.PICKUP_WK_NBR and
a.GLOBAL_DUNS_NBR = c.GLOBAL_DUNS_NBR and
a.REGION_CD=c.REGION_CD and
c.EXTRA_CALLOFF_FLAG = a.EXTRA_CALLOFF_FLAG and
a.SUPPLIER_INCOTERMS_1_CD = c.SUPPLIER_INCOTERMS_1_CD
),0) total_items_ordered
FROM
GMMT_OWNER.OR_SA_ATTAIN_DTL_T a join GMMT_OWNER.OR_SA_INCOTERMS_T b on
a.SUPPLIER_INCOTERMS_1_CD = b.INCOTERMS_CD
WHERE
b.PICKUP_ARRIVAL_FLAG='P' and
(a.PICKUP_WK_NBR between '201301' AND '201301') and
a.SUPPLIER_INCOTERMS_1_CD IN ('EXW') and
a.GLOBAL_DUNS_NBR IN ('43898092') and
a.REGION_CD IN ('AP')
GROUP BY
PICKUP_WK_NBR,REGION_CD,GLOBAL_DUNS_NBR,GLOBAL_SUPPLIER_NAME,a.EXTRA_CALLOFF_FLAG,a.SUPPLIER_INCOTERMS_1_CD
ORDER BY a.PICKUP_WK_NBR;
它给出了错误的结果。我不确定内部和外部表连接之间的 NULL 是否匹配?