SELECT DISTINCT %Sql(SCRTY_SEL_PKEY, OPR,SEC) ,NM.NAME ,NM.LAST_NAME_SRCH ,SEC.SETID_DEPT ,SEC.DEPTID FROM PSOPRDEFN OPR , PS_SJT_CLASS_ALL CLS , PS_FPAEEPOST_HIST SEC , PS_SJT_OPR_CLS SOC , PS_FPANAMES_HIST NM WHERE (CLS.SCRTY_SET_CD = 'PPLJOB' ) AND (CLS.SCRTY_TYPE_CD = '001' AND CLS.SCRTY_KEY1 = SEC.SETID_DEPT AND CLS.SCRTY_KEY2 = SEC.DEPTID) AND SOC.OPRID=OPR.OPRID AND SOC.CLASSID = CLS.CLASSID AND (( CLS.TREE = 'Y' AND SOC.CLASSID = OPR.ROWSECCLASS AND ( SOC.SEC_RSC_FLG = '1' OR SOC.SEC_RSC_FLG = '3') ) OR ( CLS.TREE = 'N' ) ) AND SEC.EMPLID = NM.EMPLID AND NM.NAME_TYPE = 'PRI' AND NM.EFFDT = ( SELECT MAX(B.EFFDT) FROM PS_FPANAMES_HIST B WHERE B.EMPLID = NM.EMPLID AND B.NAME_TYPE = 'PRI' AND B.EFFDT <= %CurrentDateIn )
|