select concat(p.pname,p.fname," ",p.lname) as ptname,v.*,o.visit_type
from vn_stat v
left outer join patient p on p.hn=v.hn
left outer join ovst o on o.vn=v.vn
where v.vstdate between "2010-10-01" and "2010-10-05"
and v.age_y>= 0
and v.age_y<= 200
and upper(o.visit_type) = "I"