SELECT tbl01.*, 
       if(ifnull(i31.timh1, 0)=0, tbl01.av191, ifnull(i31.timh1, 0)) as v191, 
       if(ifnull(i31.timh2, 0)=0, tbl01.av192, ifnull(i31.timh2, 0)) as v192, 
       if(ifnull(i31.timh3, 0)=0, tbl01.av193, ifnull(i31.timh3, 0)) as v193, 
       if(ifnull(i31.timh4, 0)=0, tbl01.av194, ifnull(i31.timh4, 0)) as v194 
FROM ({peg_str}) as tbl01
LEFT JOIN i31 ON i31.p01='{par_pararr[1]}'
              && i31.p02='{par_pararr[11]}';
       
       