SELECT E.EMPLID , E.EMPL_RCD , SUM(E.GPS_FRACTION) GPS_FRACTION , COUNT(*) GPS_DIVIDED_FRAC FROM PS_GPS_STF_DTL_VW D JOIN PS_GPS_POST_EE E ON D.EFFDT = E.EFFDT AND D.EFFSEQ = E.EFFSEQ AND D.SETID = E.SETID AND D.GPS_POST_ID = E.GPS_POST_ID WHERE D.GPS_STATUS IN ('R', 'O', 'B', 'S') AND D.EFFDT = ( SELECT MAX(EFFDT) FROM PS_GPS_STF_DTL_VW DD WHERE DD.SETID = E.SETID AND DD.EFFDT <=%CurrentDateIn AND DD.GPS_POST_ID = D.GPS_POST_ID) AND D.EFFSEQ = ( SELECT MAX(EFFSEQ) FROM PS_GPS_STF_DTL_VW DDD WHERE DDD.EFFDT = D.EFFDT AND DDD.SETID = D.SETID AND DDD.GPS_POST_ID = D.GPS_POST_ID) GROUP BY E.EMPLID, E.EMPL_RCD
|