update period set 
  period.DI002454 = subselect.DI002454_sum,
  period.DI002455 = subselect.di001345_sum,
  period.DI002464 = subselect.di001346_sum,
  period.DI002483 = subselect.di001352_sum,
  period.DI002484 = subselect.di001353_sum,
  period.DI002485 = subselect.di001354_sum,
  period.DI002486 = subselect.di001355_sum,
  period.DI002487 = subselect.di001356_sum,
  period.DI002488 = subselect.di001357_sum,
  period.DI002545 = subselect.di002373_sum,
  period.DI002546 = subselect.di002374_sum,
  period.DI002640 = subselect.di002375_sum,
  period.DI002641 = subselect.di002371_sum,
  period.DI002642 = subselect.di002372_sum
FROM dt468 period
INNER JOIN (select ISNULL(sum(DI002454), 0) as DI002454_sum, 
                   ISNULL(sum(di001345), 0) as di001345_sum, 
                   ISNULL(sum(di001346), 0) as di001346_sum,
                   ISNULL(sum(di001352), 0) as di001352_sum,
                   ISNULL(sum(di001353), 0) as di001353_sum,
                   ISNULL(sum(di001354), 0) as di001354_sum,
                   ISNULL(sum(di001355), 0) as di001355_sum,
                   ISNULL(sum(di001356), 0) as di001356_sum,
                   ISNULL(sum(di001357), 0) as di001357_sum,
                   ISNULL(sum(di002373), 0) as di002373_sum,
                   ISNULL(sum(di002374), 0) as di002374_sum,
                   ISNULL(sum(di002375), 0) as di002375_sum,
                   ISNULL(sum(di002371), 0) as di002371_sum,
                   ISNULL(sum(di002372), 0) as di002372_sum,
                   DI001327  
            from dt468
             left join DT467 child_res on (DI001326 = child_res.DI001218)
             where 
               child_res.DI009753 = '{parent_res_id}'
             group by DI001327) subselect ON subselect.DI001327 = period.DI001327
 where
  period.di001364 = 1
  and period.DI001327 BETWEEN convert(datetime, '{start_period}', 104) AND convert(datetime, '{end_period}', 104)
  and period.DI001326 = '{parent_res_id}'
  and exists 
      (select 1 from dt468 period_subselect
       left join DT467 child_res on (period_subselect.DI001326 = child_res.DI001218)
       where 
         (child_res.DI009753 = '{parent_res_id}') and 
         period_subselect.DI001327 = period.DI001327)