SELECT C.EMPLID ,A.BO_ID ,C.PERSON_ID , D.DESCR , L.DESCR , J.DESCR FROM ((PS_RD_WRKR_ASGN A INNER JOIN PS_RD_WRKR_JOB B ON A.BO_ID=B.BO_ID) INNER JOIN PS_RD_PERSON C ON B.BO_ID=C.BO_ID) LEFT OUTER JOIN PS_LOCATION_WRK_VW L ON (B.SETID_LOCATION = L.SETID_LOCATION AND B.LOCATION=L.LOCATION) LEFT OUTER JOIN PS_DEPT_TBL_WRK_VW D ON (B.SETID_DEPT = D.SETID_DEPT AND B.DEPTID=D.DEPTID) LEFT OUTER JOIN PS_JOBCD_WRK_VW J ON (B.SETID_JOBCODE = J.SETID_JOBCODE AND B.JOBCODE=J.JOBCODE) WHERE A.ASGN_END_DT >= %CurrentDateIn AND A.ASGN_START_DT <= %CurrentDateIn AND A.PRIMARY_IND='Y' AND B.PERSON_ID=A.PERSON_ID AND B.WRKR_ASGN_SEQ = A.WRKR_ASGN_SEQ AND B.EFFDT=( SELECT MAX(E.EFFDT) FROM PS_RD_WRKR_JOB E WHERE E.EFFDT<=%CurrentDateIn AND E.PERSON_ID=B.PERSON_ID AND E.WRKR_ASGN_SEQ = B.WRKR_ASGN_SEQ) AND B.EFFSEQ=( SELECT MAX(F.EFFSEQ) FROM PS_RD_WRKR_JOB F WHERE F.EFFDT=B.EFFDT AND F.PERSON_ID=B.PERSON_ID AND F.WRKR_ASGN_SEQ = B.WRKR_ASGN_SEQ)
|