Martti, Good Stuff.I enjoyed it. For Oracle i modified the Query and here is it. select (select unique_name from srm_projects s where s.id=project_id) "Project Id",
(select unique_name from srm_resources s where s.id=resource_id)"Resource Id",
nvl(sum(Month_3),0) "Month - 3" , nvl(sum(Month_2),0) "Month - 2", nvl(sum(Month_1),0) "Month - 1" ,
nvl(sum(Cur_Month),0) "Current Month",nvl(sum(Month1),0) "Month + 1", nvl(sum(Month2),0)"Month + 2" ,
nvl(sum(Month3),0) "Month + 3"
from
(
SELECT Project_Id,
Resource_Id,
case when REQUEST_NAME='MONTHLYRESOURCEACTCURVE' and TRUNC(ADD_MONTHS(SYSDATE, -3),'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Month_3,
case when REQUEST_NAME='MONTHLYRESOURCEACTCURVE' and TRUNC(ADD_MONTHS(SYSDATE, -2),'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Month_2,
case when REQUEST_NAME='MONTHLYRESOURCEACTCURVE' and TRUNC(ADD_MONTHS(SYSDATE, -1),'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Month_1,case when REQUEST_NAME='MONTHLYRESOURCEACTCURVE' and TRUNC(SYSDATE,'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Cur_Month,case when REQUEST_NAME='MONTHLYRESOURCEESTCURVE' and TRUNC(ADD_MONTHS(SYSDATE, +1),'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Month1,
case when REQUEST_NAME='MONTHLYRESOURCEESTCURVE' and TRUNC(ADD_MONTHS(SYSDATE, +2),'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Month2,
case when REQUEST_NAME='MONTHLYRESOURCEESTCURVE' and TRUNC(ADD_MONTHS(SYSDATE, +3),'MM')=SLICE_MONTH then nvl(sum(Actual_hours),0) else 0 end Month3
from
(
select
prtask.prprojectid project_id,
prassignment.prresourceid resource_id,request_name,
to_char(TRUNC(prj_blb_slices.slice_date,'YEAR'),'YYYY') Year,
TRUNC(prj_blb_slices.slice_date,'MONTH') SLICE_MONTH,
nvl(sum(prj_blb_slices.slice),0) Actual_hours
from
prj_blb_slices,
prj_blb_slicerequests,
prtask,
prassignment
where
prj_blb_slices.slice_date >= TRUNC(SysDate,'YEAR')
and prj_blb_slices.slice_date