改变从内到外的加入

时间:2017-07-11 10:27:39

标签: sql database join inner-join outer-join

我是oracle /数据库工作的新手我一直被要求将下面的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;

1 个答案:

答案 0 :(得分:0)

FROM IMPORTDB.IMP_SV imp
  FULL OUTER JOIN POLLIMP.LBO_LIST lbo
  ON imp.MERCHANT_ID = lbo.MERCHANT_ID;