

SELECT ifnull(a01.nr01, 0) as a01_nr01, 
       ifnull(a01.p06, 0)  as a01_p06, 
       ifnull(a01.p48, 0)  as a01_p48, 
       ifnull(a01.p52, 0)  as a01_p52, 
       ifnull(a01.p52a, 0) as a01_p52a, 
       
       ifnull(i00.pno, '')  as i00_pno, 
       ifnull(i00.p9901, 0) as i00_p9901, 
       ifnull(i00.p614, 0)  as i00_p614, 
       ifnull(i00.p617, 0)  as i00_p617, 
       ifnull(i00.timh1, 0) as timh1, 
       ifnull(i00.timh2, 0) as timh2, 
       ifnull(i00.timh3, 0) as timh3, 
       ifnull(i00.timh4, 0) as timh4, 
       
       
       ifnull(f02.p615, 0) as f02_p615 
FROM f02
LEFT JOIN a01 ON a01.nr01=if({pub_arr1[1]}=0, f02.pl01, {pub_arr1[1]})
LEFT JOIN i00 ON i00.pno='{pub_arr1[2]}'
WHERE f02.nr01=1;
       
       