select i00tot.pno1 as p01,
       sum(if(i00tot.p610={par_pararr[3]}, i00tot.p03, 0)) as ypol,
       sum(if(i00tot.p610={par_pararr[3]}, i00tot.p04, 0)) as papel,
       sum(if(i00tot.p610={par_pararr[3]}, i00tot.p05, 0)) as papro, 
       sum(if(i00tot.p610={par_pararr[3]}, i00tot.p06, 0)) as paesot,

       sum(if(i00tot.p610={par_pararr[13]} && i00tot.p610<>-1, i00tot.p03, 0)) as ypol_1,
       sum(if(i00tot.p610={par_pararr[13]} && i00tot.p610<>-1, i00tot.p04, 0)) as papel_1,
       sum(if(i00tot.p610={par_pararr[13]} && i00tot.p610<>-1, i00tot.p05, 0)) as papro_1, 
       sum(if(i00tot.p610={par_pararr[13]} && i00tot.p610<>-1, i00tot.p06, 0)) as paesot_1,

       sum(if(i00tot.p610={par_pararr[14]} && i00tot.p610<>-1, i00tot.p03, 0)) as ypol_2,
       sum(if(i00tot.p610={par_pararr[14]} && i00tot.p610<>-1, i00tot.p04, 0)) as papel_2,
       sum(if(i00tot.p610={par_pararr[14]} && i00tot.p610<>-1, i00tot.p05, 0)) as papro_2, 
       sum(if(i00tot.p610={par_pararr[14]} && i00tot.p610<>-1, i00tot.p06, 0)) as paesot_2,

       sum(i00tot.p03) as typol,
       sum(i00tot.p04) as tpapel,
       sum(i00tot.p05) as tpapro, 
       sum(i00tot.p06) as tpaesot
FROM i00tot
WHERE i00tot.pno1='{par_pararr[1]}'
GROUP BY i00tot.pno1; 
