select
    ifnull(da8.nr01, 0) as nr01,
    da5.nr01 as p02,
    da8.p03 as p03,
    da8.p04 as p04,
    da8.p05 as p05,
    da5.nr01 as da5nr01,
    da5.p01  as da5p01,
    da5.p02  as da5p02,
    da5.p03  as da5p03,
    da5.p04  as da5p04,
    da5.p05  as da5p05,
    da5.p06  as da5p06,
    da5.p07  as da5p07,
    da5.p010 as da5p010,
    da5.p011 as da5p011,
    da5.p30  as da5p30,
    da8.p03  as vp03,
    da6.p02  as da6p02,
    da7.p03  as da7p03
from  ( SELECT * 
        FROM d01
        WHERE {pub_arr3[1]}
        ORDER BY {pub_arr3[2]}
        LIMIT 1
      ) as d01
left join da5 on da5.p01=d01.p421
LEFT JOIN da8 ON da5.nr01=da8.p02
              && da8.p01=d01.nr01
LEFT JOIN da7 ON da7.nr01=da8.p04
LEFT JOIN da6 ON da6.nr01=da5.p07;
