SELECT DISTINCT A.SETID , B.CUST_ID , A.PPRC_PROMO_CD , D.LANGUAGE_CD , D.DESCR FROM PS_PPRC_PROMO_TBL A , PS_CUSTOMER B , PS_SET_CNTRL_REC C , PS_PPRC_PROTBL_LNG D WHERE A.EFF_STATUS = 'A' AND A.SETID = C.SETID AND C.RECNAME = 'PPRC_PROMO_TBL' AND C.SETCNTRLVALUE = B.SETID AND A.SETID = D.SETID AND A.PPRC_PROMO_CD = D.PPRC_PROMO_CD AND ((EXISTS( SELECT 'X' FROM PS_TD_PROMO_CUST D WHERE A.SETID = D.SETID AND A.PPRC_PROMO_CD = D.PPRC_PROMO_CD AND B.CUST_ID = D.CUST_ID AND D.status_td = 'CA')) OR (EXISTS( SELECT 'X' FROM PS_TD_ALLOW_CUST E WHERE A.SETID = E.SETID AND A.PPRC_PROMO_CD = E.PPRC_PROMO_CD AND B.CUST_ID = E.CUST_ID AND E.cust_id <> ' ' ) AND A.promo_type = 'A' AND A.allow_status = '4' ))
|