ลองผิดลองถูก ตอนนี้ได้ประมาณนี้ครับ
select p.hn,v.vstdate,concat(p.pname," ",p.fname," ",p.lname)as name,s.name as sex,pn.cardno,n.name,na.name,m.name,p.informname,p.informaddr,o.height,o.bw,v.age_y from patient p
left outer join opdscreen o on o.hn = p.hn
left outer join nationality n on n.nationality = p.nationality
left outer join marrystatus m on m.code = p.marrystatus
left outer join sex s on s.code = p.sex
left outer join vn_stat v on v.hn = o.hn
left outer join ptcardno pn on pn.hn = p.hn
left outer join nationality na on na.nationality = p.citizenship
where v.vstdate between '2011-01-01' AND '2011-01-07' and v.pttype = 03 and pn.cardtype = "02"
group by p.hn
ไฟร์ที่ทดสอบครับ