SELECT PREF_AWD.OPRID , AWD.BUSINESS_UNIT , AWD.CONTRACT_NUM , AWD_LNG.LANGUAGE_CD , AWD_LNG.TITLE56 , CUST_LNG.NAME1 FROM PS_GM_AWARD AWD , PS_GM_AWARD_LNG AWD_LNG , PS_CUSTOMER CUST , PS_CUSTOMER_LANG CUST_LNG , PS_GM_MY_PREF PREF_AWD WHERE PREF_AWD.BUSINESS_UNIT = AWD.BUSINESS_UNIT AND AWD_LNG.CONTRACT_NUM = AWD.CONTRACT_NUM AND ((PREF_AWD.BEGIN_DT <= AWD.BEGIN_DT) OR PREF_AWD.BEGIN_DT IS NULL) AND ((PREF_AWD.GM_SELECT_PI ='N') OR (PREF_AWD.GM_SELECT_PI ='Y' AND EXISTS ( SELECT 'X' FROM PS_GM_PREF_PI PREF_PI WHERE PREF_PI.OPRID = PREF_AWD.OPRID AND PREF_PI.EMPLID = AWD.EMPLID ))) AND ((PREF_AWD.GM_SEL_AWD_STS ='N') OR (PREF_AWD.GM_SEL_AWD_STS ='Y' AND EXISTS ( SELECT 'X' FROM PS_GM_PREF_AWD_STS PREF_STS WHERE PREF_STS.OPRID = PREF_AWD.OPRID AND PREF_STS.AWARD_STATUS = AWD.AWARD_STATUS ))) AND CUST.CUST_ID = AWD.CUST_ID AND CUST.CUST_ID = CUST_LNG.CUST_ID AND CUST.SETID = CUST_LNG.SETID AND CUST.SETID = ( SELECT REC.SETID FROM PS_SET_CNTRL_REC REC WHERE REC.RECNAME = 'CUSTOMER' AND AWD.BUSINESS_UNIT = REC.SETCNTRLVALUE ) AND ((PREF_AWD.GM_SELECT_SPONSOR ='N') OR (PREF_AWD.GM_SELECT_SPONSOR ='Y' AND EXISTS ( SELECT 'X' FROM PS_GM_PREF_SPONSOR PREF_SPN WHERE PREF_SPN.OPRID = PREF_AWD.OPRID AND PREF_SPN.CUST_ID = AWD.CUST_ID AND PREF_SPN.SETID = CUST.SETID )))
|