select
    i00_apoth.pno as  p01,
    i00_apoth.name as p02,
    i00_apoth.ypol as p03,
    i00_apoth.p610 as p04,
    i16.p01 as vp04,
    i00_apoth.ths as p05,
    i00_apoth.vths as vp05

from i00_apoth
LEFT JOIN i16 ON i16.p00=i00_apoth.p610

where i00_apoth.a01nr01='{nt_p01}'
   && i00_apoth.p610>='{nt_xo1}'
   && i00_apoth.p610<='{nt_xo2}';