SELECT A.GB_GROUP_ID ,B.CURRENCY_CD ,A.BUDGET_START_DT ,SUM(B.ANNUAL_RT) ,SUM(B.FTE) ,COUNT(*) FROM PS_GROUP_INCR_CNTL A ,PS_SAL_PLN_GRP_RES R ,PS_JOB B ,PS_PER_ORG_ASGN_VW C ,PS_PERSON P WHERE A.GB_GROUP_ID = R.GB_GROUP_ID AND R.VERSIONGBQDM = ( SELECT MAX(R2.VERSIONGBQDM) FROM PS_SAL_PLN_GRP_RES R2 WHERE R.GB_GROUP_ID = R2.GB_GROUP_ID) AND R.EMPLID = B.EMPLID AND R.EMPL_RCD = B.EMPL_RCD AND B.EFFDT = R.JOB_EFFDT AND B.EFFSEQ = R.JOB_EFFSEQ AND B.EFFDT = ( SELECT MAX(R1.EFFDT) FROM PS_JOB R1 WHERE B.EMPLID = R1.EMPLID AND B.EMPL_RCD = R1.EMPL_RCD AND R1.EFFDT <= A.SAL_PLAN_START_DT) AND B.EFFSEQ = ( SELECT MAX(R3.EFFSEQ) FROM PS_JOB R3 WHERE B.EMPLID = R3.EMPLID AND B.EMPL_RCD = R3.EMPL_RCD AND B.EFFDT = R3.EFFDT) AND B.EMPLID = P.EMPLID AND C.PER_ORG = 'EMP' AND B.HR_STATUS = 'A' AND C.EMPLID = B.EMPLID AND C.EMPL_RCD = B.EMPL_RCD AND ( (A.ANNIVERSARY_SW = 'N' AND C.LAST_HIRE_DT <=A.NEW_HIRE_ELIG_DT) OR (A.ANNIVERSARY_SW = 'Y' AND C.LAST_HIRE_DT < A.BUDGET_START_DT ) ) GROUP BY A.GB_GROUP_ID, B.CURRENCY_CD,A.BUDGET_START_DT
|