1.แนะนำตัวด้วยครับ
2.ลองดึงจากคลินิกก่อนซิครับ
select v.hn,c1.name,v.vstdate,concat(p.pname,p.fname," ",p.lname)as f_name,concat(p.addrpart," ","Á.",p.moopart," ",a.full_name) as tt
,if(v.sex="1","ªÒÂ","Ë­Ô§")as sex,v.pttype,pt.name,concat(v.age_y," ","»Õ"," ",v.age_m," ","à´×͹")as age
from vn_stat v
left outer join patient p on p.hn=v.hn
left outer join clinicmember c on c.hn=p.hn
left outer join clinic c1 on c1.clinic=c.clinic
left outer join thaiaddress a on a.addressid=v.aid
left outer join pttype pt on pt.pttype=v.pttype
left outer join icd101 i on i.code = v.pdx
where v.vstdate between "2009-10-01" and "2009-10-10" and c.clinic in(001,002)
and i.code in ("I64","I613","I500","N189","I259")