SELECT J.EMPLID , EMPL_RCD , J.EFFDT , J.EFFSEQ , C.TREE_NAME , J.DEPTID , P.TREE_NODE FROM PSTREENODE C , PSTREENODE P , PS_JOB J WHERE C.SETID = P.SETID AND C.SETCNTRLVALUE = P.SETCNTRLVALUE AND C.TREE_NAME = P.TREE_NAME AND C.EFFDT = P.EFFDT AND C.PARENT_NODE_NUM = P.TREE_NODE_NUM AND J.SETID_DEPT = C.SETID AND C.SETCNTRLVALUE = ' ' AND J.DEPTID = C.TREE_NODE AND C.EFFDT = ( SELECT MAX(T.EFFDT) FROM PSTREENODE T WHERE C.SETID = T.SETID AND C.SETCNTRLVALUE = T.SETCNTRLVALUE AND C.TREE_NAME = T.TREE_NAME AND T.EFFDT <= J.EFFDT)
|