select pt.hn,concat(pt.pname,pt.fname," ",pt.lname) as patient_name,pt.moopart,thd.full_name ,ov.hn,ov.pdx ,i.name
from vn_stat ov ,patient pt ,ovst ovst
left outer join icd101 i on i.code = ov.pdx
left outer join thaiaddress thd on thd.addressid = ov.aid
where ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2007-03-01" and "2007-03-01"
and ov.age_y>= 0
and ov.age_y<= 200
and ovst.main_dep="010"
and ovst.visit_type = "o"