SELECT TAX.POSITION_NBR ,SUM(TAX.BUDGET_AMT) ,SUM(TAX.DIST_PCT) FROM PS_DEPT_BUDGET_TAX TAX WHERE TAX.EFFDT = ( SELECT MAX(DTB.EFFDT) FROM PS_DEPT_BUDGET DTB WHERE DTB.SETID = TAX.SETID AND DTB.DEPTID = TAX.DEPTID AND DTB.FISCAL_YEAR = TAX.FISCAL_YEAR AND DTB.EFFDT <= %CurrentDateIn) AND EXISTS ( SELECT 'X' FROM PS_DEPT_BUDGET DTB1 WHERE DTB1.SETID = TAX.SETID AND DTB1.DEPTID = TAX.DEPTID AND DTB1.FISCAL_YEAR = TAX.FISCAL_YEAR AND DTB1.EFFDT = TAX.EFFDT AND DTB1.EFF_STATUS = 'A') AND EXISTS ( SELECT 'X' FROM PS_DEPT_BUDGET_DT DT WHERE DT.SETID = TAX.SETID AND DT.DEPTID = TAX.DEPTID AND DT. FISCAL_YEAR = TAX.FISCAL_YEAR AND DT.BUDGET_BEGIN_DT <= %CurrentDateIn AND DT.BUDGET_END_DT >= %CurrentDateIn) GROUP BY TAX.POSITION_NBR
|