SELECT DISTINCT OPR.OPRID , SEC.EMPLID FROM PS_SJT_PERSON SEC , PSOPRDEFN OPR WHERE SEC.APPT_TYPE <> '1' AND SEC.FUTURE_FLG <> 'Y' AND EXISTS( SELECT 'X' FROM PS_SJT_CLASS_ALL CLS , PS_SJT_OPR_CLS SOC WHERE CLS.SCRTY_TYPE_CD = SEC.SCRTY_TYPE_CD AND CLS.SCRTY_KEY1 = SEC.SCRTY_KEY1 AND CLS.SCRTY_KEY2 = SEC.SCRTY_KEY2 AND CLS.SCRTY_KEY3 = SEC.SCRTY_KEY3 AND SOC.OPRID = OPR.OPRID AND SOC.CLASSID = CLS.CLASSID AND CLS.SCRTY_SET_CD IN ('PPLJOB', 'PPLPOI') AND (CLS.TREE = 'N' OR (CLS.TREE = 'Y' AND SOC.CLASSID = OPR.ROWSECCLASS AND SOC.SEC_RSC_FLG IN ('1', '3'))))
|