select
asset_info,month_year,
sum(incident_total) total_cnt
from
reoccuring_incident
where
asset_info in (
select asset_info from
(
select asset_info,month_year,
sum(incident_total) total_cnt
from reoccuring_incident
where
to_date(month_year,'MON-YYYY') = 'DEC-2009'
GROUP BY asset_info,month_year
order by total_cnt desc
)
where ROWNUM <= :P501_P1_NUMBER_OF_ROWS)
and to_date(month_year,'MON-YYYY') between add_months(to_date(:P501_START_DATE,'Mon-yyyy'),-3) and to_date(:P501_START_DATE,'Mon-yyyy')
group by asset_info,month_year
Bookmarks