SELECT A.EMPLID , A.EMPL_RCD , C.NAME_DISPLAY , B.MIL_RANK , B.MIL_WORN_RANK , D.MILITARY_SERVICE FROM PS_JOB A , PS_JOB_MIL B , PS_NAMES C , PS_PER_ORG_INS_MIL D ,PS_PER_ORG_ASGN E WHERE ( A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_JOB A_ED WHERE A.EMPLID = A_ED.EMPLID AND A.EMPL_RCD = A_ED.EMPL_RCD AND A_ED.EFFDT <= %CurrentDateIn) AND A.EFFSEQ = ( SELECT MAX(A_ES.EFFSEQ) FROM PS_JOB A_ES WHERE A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT) AND A.EMPLID = B.EMPLID AND A.EMPL_RCD = B.EMPL_RCD AND B.EFFDT = ( SELECT MAX(B_ED.EFFDT) FROM PS_JOB_MIL B_ED WHERE B.EMPLID = B_ED.EMPLID AND B.EMPL_RCD = B_ED.EMPL_RCD AND B_ED.EFFDT <= A.EFFDT) AND B.EFFSEQ = ( SELECT MAX(B_ES.EFFSEQ) FROM PS_JOB_MIL B_ES WHERE B.EMPLID = B_ES.EMPLID AND B.EMPL_RCD = B_ES.EMPL_RCD AND B.EFFDT = B_ES.EFFDT) AND B.EMPLID = C.EMPLID AND C.EFFDT = ( SELECT MAX(C_ED.EFFDT) FROM PS_NAMES C_ED WHERE C.EMPLID = C_ED.EMPLID AND C.NAME_TYPE = C_ED.NAME_TYPE AND C_ED.EFFDT <= B.EFFDT) AND C.EMPLID = D.EMPLID ) AND A.PER_ORG ='EMP' AND E.EMPLID = D.EMPLID AND E.EMPL_RCD = A.EMPL_RCD AND E.ORG_INSTANCE_ERN = D.ORG_INSTANCE_ERN AND E.PER_ORG = 'EMP'
|