select 
      v101 as v101, 
      v102 as v102, 
      1 as v103, 
      round({peg_arr1[1]} * {nt_poso} / {peg_arr1[2]}, 2) as v104, 
      round({peg_arr1[1]} * {nt_poso} / {peg_arr1[2]}, 2) as v107, 
      pi01 as pi01, 
      pi02 as pi02, 
      pi03 as pi03 

FROM 
(
select 
    v101 as v101, 
    v102 as v102,     
    sum(pi01) as pi01, 
    sum(pi02) as pi02, 
    sum(pi03) as pi03, 
    0 as pi00
    
FROM 

( {peg_str1}
) as t1
GROUP BY v101
) as t2;