2016-01-18 49 views
0
proc sql noprint; 
      CREATE TABLE WORK.TRANS_SENT_TO_USA AS 
        SELECT DISTINCT T3.role_desc , T1.ACCOUNT_KEY , T1.TRANSACTION_KEY , 
          T2.MOnth_key , 
          T1.DATE_KEY as DAY , 
          T1.CURRENCY_AMOUNT_IN_ACCOUNT_CCY as AMOUNT , 
          T5.ACCOUNT_CURRENCY_CODE as currency , 
          T6.FULL_NAME, 
          MAX(T4.BANK_NAME) as Ben_Bank 
        FROM DB_CORE.FSC_CASH_FLOW_FACT T1 
          INNER JOIN DB_CORE.FSC_DATE_DIM T2 
            ON T1.DATE_KEY = T2.DATE_KEY 
          INNER JOIN DB_CORE.FSC_CASH_FLOW_BANK_BRIDGE T3 
            ON T1.TRANSACTION_KEY = T3.TRANSACTION_KEY 
          INNER JOIN DB_CORE.FSC_BANK_DIM T4 
            ON T3.BANK_KEY = T4.BANK_KEY 
          INNER JOIN DB_CORE.FSC_ACCOUNT_DIM T5 
            ON T1.ACCOUNT_KEY = T5.ACCOUNT_KEY 
          INNER JOIN DB_CORE.FSC_EXT_PARTY_ACCOUNT_DIM T6 
            ON T1.BENEFICIARY_EXT_PARTY_KEY = T6.EXT_PARTY_ACCOUNT_KEY 
          WHERE T2.CALENDAR_DATE >= "&LAST_RUN_DATE"D 
              AND T3.ROLE_DESC like '%BENEFICIARY%' 
              AND T4.BANK_COUNTRY_CODE LIKE 'US%' 
          Group by T3.role_desc ,T1.ACCOUNT_KEY , T1.TRANSACTION_KEY , 
              T2.MOnth_key , 
              T1.DATE_KEY , 
              T1.CURRENCY_AMOUNT_IN_ACCOUNT_CCY , 
              T5.ACCOUNT_CURRENCY_CODE ; 
    RUN;  
+2

請在你的問題中添加一些細節?你收到錯誤信息了嗎?什麼不適合你? – Reeza

回答

0

FULL_NAME是不是在GROUP BY。這應該會導致問題,但是您再次沒有具體描述您的問題。

+0

這不是SAS SQL的要求,但不確定AML是基於什麼。 – Reeza

+1

他問他的查詢出了什麼問題,而不是他爲什麼得到某個特定的錯誤。在許多dbms中,不包括組中的非概要列會產生一個錯誤。無論如何,排除group_name中的full_name可能會產生他沒有預料到的結果。 – floydn

+0

您和我正在辯論OP應澄清問題確切性質的潛在問題。 – floydn