-- fix effort total in DT823 for existing program status reports
update DT823
set DI008610 = source.effort_total,
	DI008615 = source.effort_budget_total
from
(select DI060297, DI060300,
	 isnull(sum(DI060605),0) effort_total,
	 isnull(sum(DI060334),0) effort_budget_total
 from DT284
 group by DI060297, DI060300) source
where DI008413 in (select DI001001 from DT461
                   where DI023220 = 30)
and DT823.DI008413 = source.DI060297
and DT823.DI008416 = source.DI060300;