SELECT A.SETID , A.CONTACT_ID , B.CUSTOMER_SETID , B.CUST_ID , D.LANGUAGE_CD , D.NAME1 , E.NAME1 FROM PS_CONTACT A , PS_CONTACT_CUST B , PS_CUSTOMER C , PS_CONTACT_LANG D , PS_CUSTOMER_LANG E WHERE %Join(COMMON_KEYS, CONTACT A, CONTACT_CUST B) AND %EffdtCheck(CONTACT A2, A, %CurrentDateIn) AND B.CUSTOMER_SETID=C.SETID AND B.CUST_ID=C.CUST_ID AND %Join(COMMON_KEYS, CONTACT A, CONTACT_LANG D) AND %Join(COMMON_KEYS, CUSTOMER C, CUSTOMER_LANG E) AND D.LANGUAGE_CD = E.LANGUAGE_CD UNION SELECT F.SETID , F.CONTACT_ID , G.CUSTOMER_SETID , G.CUST_ID , I.LANGUAGE_CD , I.NAME1 , H.NAME1 FROM PS_CONTACT F , PS_CONTACT_CUST G , PS_CUSTOMER H , PS_CONTACT_LANG I WHERE %Join(COMMON_KEYS, CONTACT F, CONTACT_CUST G) AND %EffdtCheck(CONTACT F2, F, %CurrentDateIn) AND G.CUSTOMER_SETID=H.SETID AND G.CUST_ID=H.CUST_ID AND %Join(COMMON_KEYS, CONTACT F, CONTACT_LANG I) AND NOT EXISTS ( SELECT 'X' FROM PS_CUSTOMER_LANG J WHERE %Join(COMMON_KEYS, CUSTOMER H, CUSTOMER_LANG J) AND J.LANGUAGE_CD = I.LANGUAGE_CD) UNION SELECT K.SETID , K.CONTACT_ID , L.CUSTOMER_SETID , L.CUST_ID , N.LANGUAGE_CD , K.NAME1 , N.NAME1 FROM PS_CONTACT K , PS_CONTACT_CUST L , PS_CUSTOMER M , PS_CUSTOMER_LANG N WHERE %Join(COMMON_KEYS, CONTACT K, CONTACT_CUST L) AND %EffdtCheck(CONTACT K2, K, %CurrentDateIn) AND L.CUSTOMER_SETID=M.SETID AND L.CUST_ID=M.CUST_ID AND %Join(COMMON_KEYS, CUSTOMER M, CUSTOMER_LANG N) AND NOT EXISTS ( SELECT 'X' FROM PS_CONTACT_LANG O WHERE %Join(COMMON_KEYS, CONTACT K, CONTACT_LANG O) AND O.LANGUAGE_CD = N.LANGUAGE_CD)
|