SELECT A.EMPLID , A.EMPL_RCD , A.EFFDT , A.setid_jobcode , A.JOBCODE FROM PS_CURRENT_JOB_ALL A WHERE A.JOBCODE <> ( SELECT B.JOBCODE FROM PS_CURRENT_JOB_ALL B WHERE B.EMPLID = A.EMPLID AND B.EMPL_RCD = A.EMPL_RCD AND B.EFFDT = ( SELECT MAX(EFFDT) FROM PS_CURRENT_JOB_ALL B1 WHERE B1.EMPLID = B.EMPLID AND B1.EMPL_RCD = B.EMPL_RCD AND B1.EFFDT < A.EFFDT)) OR A.EFFDT = ( SELECT MIN(EFFDT) FROM PS_CURRENT_JOB_ALL C1 WHERE C1.EMPLID = A.EMPLID AND c1.empl_rcd = A.empl_rcd) OR A.ACTION IN ('REH', 'HIR')
|