将连接从内部更改为外部
Change Join from Inner to Outer
我是 oracle/database 一般工作的新手 我被要求将下面的 SQL 从内部联接更改为完整的外部联接,我该怎么做?
SELECT lbo.EPOS_LBO_NO EPOS_LBO_NO,
imp.VOUCHER_NUMBER,
imp.VOUCHER_STATUS,
(CASE imp.VOUCHER_STATUS
WHEN 'R' THEN 63
WHEN 'I' THEN 62
ELSE 99999
END) TRANSFER_TYPE_ID,
imp.VOUCHER_ISSUE_TYPE,
to_date ( imp.DATE_OF_MOVEMENT || ' ' || imp.TIME_OF_MOVEMENT, 'dd/mm/yyyy hh24:mi:ss') DATE_OF_MOVEMENT,
to_date ( imp.VOUCHER_DATE_ISSUED || ' ' || imp.VOUCHER_TIME_ISSUED, 'dd/mm/yyyy hh24:mi:ss') VOUCHER_DATE_ISSUED,
imp.VOUCHER_VALUE,
imp.MERCHANT_ID,
imp.MEM_MEMBER_ID,
imp.COMPANY_NAME,
imp.OWNING_MEMBER_ID,
imp.OWNING_MEMBER_NAME,
imp.PRODUCT_CODE,
imp.PRODUCT_DESCRIPTION,
imp.PG_PRODUCT_GROUP_ID
FROM IMPORTDB.IMP_SV imp
, POLLIMP.LBO_LIST lbo
WHERE imp.MERCHANT_ID = lbo.MERCHANT_ID;
FROM IMPORTDB.IMP_SV imp
FULL OUTER JOIN POLLIMP.LBO_LIST lbo
ON imp.MERCHANT_ID = lbo.MERCHANT_ID;
我是 oracle/database 一般工作的新手 我被要求将下面的 SQL 从内部联接更改为完整的外部联接,我该怎么做?
SELECT lbo.EPOS_LBO_NO EPOS_LBO_NO,
imp.VOUCHER_NUMBER,
imp.VOUCHER_STATUS,
(CASE imp.VOUCHER_STATUS
WHEN 'R' THEN 63
WHEN 'I' THEN 62
ELSE 99999
END) TRANSFER_TYPE_ID,
imp.VOUCHER_ISSUE_TYPE,
to_date ( imp.DATE_OF_MOVEMENT || ' ' || imp.TIME_OF_MOVEMENT, 'dd/mm/yyyy hh24:mi:ss') DATE_OF_MOVEMENT,
to_date ( imp.VOUCHER_DATE_ISSUED || ' ' || imp.VOUCHER_TIME_ISSUED, 'dd/mm/yyyy hh24:mi:ss') VOUCHER_DATE_ISSUED,
imp.VOUCHER_VALUE,
imp.MERCHANT_ID,
imp.MEM_MEMBER_ID,
imp.COMPANY_NAME,
imp.OWNING_MEMBER_ID,
imp.OWNING_MEMBER_NAME,
imp.PRODUCT_CODE,
imp.PRODUCT_DESCRIPTION,
imp.PG_PRODUCT_GROUP_ID
FROM IMPORTDB.IMP_SV imp
, POLLIMP.LBO_LIST lbo
WHERE imp.MERCHANT_ID = lbo.MERCHANT_ID;
FROM IMPORTDB.IMP_SV imp
FULL OUTER JOIN POLLIMP.LBO_LIST lbo
ON imp.MERCHANT_ID = lbo.MERCHANT_ID;