SELECT A.EMPLID , A.EMPL_RCD , A.PIN_ENTL_BAL_NUM , SUM(DURATION_ABS) FROM PS_GP_ABS_BALSS_VW A , PS_GP_PIN_CMPNT B , PS_GP_ABS_TAKE_ENT C , PS_GP_ABSHISTSS_VW D WHERE B.PIN_ENTL_BAL_NUM = A.PIN_ENTL_BAL_NUM AND C.PIN_ENT_NUM = B.PIN_NUM AND C.PRIORITY = ( SELECT MIN(PRIORITY) FROM PS_GP_ABS_TAKE_ENT WHERE PIN_ENT_NUM = C.PIN_ENT_NUM) AND D.EMPLID = A.EMPLID AND D.EMPL_RCD = A.EMPL_RCD AND D.PIN_TAKE_NUM = C.PIN_NUM AND D.PROCESS_DT IS NULL AND D.WF_STATUS NOT IN ('C', 'N') GROUP BY A.EMPLID, A.EMPL_RCD, A.PIN_ENTL_BAL_NUM
|