หรืออย่างนี้ก็ได้ครับ
select v.hn,concat(p.pname,p.fname," ", p.lname) as patient_name,v.pdx,v.dx0,v.dx1,v.dx2,v.dx3,v.dx4,v.dx5
from vn_stat v
left outer join patient p on p.hn= v.hn
left outer join opdscreen s on s.vn= v.vn
where (v.vstdate between "2007-10-01" and "2008-09-30")
and ( (v.pdx between "I100" and "I159")
or (v.dx0 between "I100" and "I159")
or (v.dx1 between "I100" and "I159")
or (v.dx2 between "I100" and "I159")
or (v.dx3 between "I100" and "I159")
or (v.dx4 between "I100" and "I159")
or (v.dx5 between "I100" and "I159"))
and ((v.pdx like "I64")
or (v.dx0 like "I64")
or (v.dx1 like "I64")
or (v.dx2 like "I64")
or (v.dx3 like "I64")
or (v.dx4 like "I64")
or (v.dx5 like "I64"))
แล้วแต่ถนัดครับ