I have the following query and need to rewrite it without the use of a subquery due to materialized view limitations in Oracle. Is there a good place for reference for rewriting these types of queries?

select b.tagname, b.data_date,
(select sum(a.total)
from sh_daystats_2002 a
where a.tagname = b.tagname
and a.data_date <= b.data_date
and to_char(a.data_date,'MON-RRRR') = to_char(b.data_date, 'MON-RRRR')
and a.data_type = b.data_type) as mtd_total,
(select sum(a.total)
from sh_daystats_2002 a
where a.tagname = b.tagname
and a.data_date <= b.data_date
and a.data_type = b.data_type) as ytd_total
from sh_daystats_2002 b

Thank you!