1

以下のクエリ c.EXTRA_CALLOFF_FLAG = a.EXTRA_CALLOFF_FLAG には、1 つは Y、もう 1 つは NULL の 2 つの一致があります。

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 が一致しているかどうかわかりません。

4

1 に答える 1