0

我正在尝试使用左外连接在 HANA 中构建查询。我在 where 子句中使用 (+) 符号。我在 Oracle 中经常这样做;但在 HANA 中它返回一个语法错误。HANA 是否支持这种语法?

select * 
FROM
   "_SYS_BIC"."FinancialReporting.ReportingViews.Tech_Analytics/CV_LOA_FINANCIAL_DETAIL_GRA" F1,
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_ACCOUNT_GRA" F2,
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_COMPANY_GRA" F3,
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_COSTCENTER_GRA" F4,
   "_SYS_BIC"."FinancialReporting.ReportingViews/CV_LOA_MEASURES_LEVELS_TA_GRA" F5,
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_VENDOR_GRA" F6
WHERE
   (F1."acct_nmbr" = F2."acct_nmbr")
   AND (F1."company_cd" = F3."company_cd")
   AND (F1."cost_center_cd" = F4."cost_center_cd")
   AND (F1."acct_nmbr" = F5."acct_nmbr")
   AND F1."vendor_cd" = F6."vendor_cd"(+)
   AND (F1."acctg_dt" >= '2016-01-01'
   AND F1."acctg_dt" <= '2016-02-01'))
4

1 回答 1

4

您需要学习使用标准JOIN语法:

select * 
FROM "_SYS_BIC"."FinancialReporting.ReportingViews.Tech_Analytics/CV_LOA_FINANCIAL_DETAIL_GRA" F1 JOIN
    "_SYS_BIC"."FinancialReporting.MasterData/CV_D_ACCOUNT_GRA" F2
    ON F1."acct_nmbr" = F2."acct_nmbr" JOIN
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_COMPANY_GRA" F3
    ON F1."company_cd" = F3."company_cd" JOIN
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_COSTCENTER_GRA" F4
    ON F1."cost_center_cd" = F4."cost_center_cd" JOIN
   "_SYS_BIC"."FinancialReporting.ReportingViews/CV_LOA_MEASURES_LEVELS_TA_GRA" F5
   ON F1."acct_nmbr" = F5."acct_nmbr" LEFT JOIN
   "_SYS_BIC"."FinancialReporting.MasterData/CV_D_VENDOR_GRA" F6
    ON F1."vendor_cd" = F6."vendor_cd"
WHERE F1."acctg_dt" >= '2016-01-01' AND F1."acctg_dt" <= '2016-02-01';
于 2017-06-06T14:30:53.870 回答