select pt.*,ov.*
from vn_stat ov ,patient pt ,ovst ovst
where ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2007-01-01" and "2009-07-30" and ov.hn=pt.hn
and ov.aid="960501"
and ov.age_y>= 0
and ov.age_y<= 200
and ( (ov.pdx >= "E10" and ov.pdx <= "E148")
or (ov.dx0 >= "E10" and ov.dx0 <= "E148")
or (ov.dx1 >= "E10" and ov.dx1 <= "E148")
or (ov.dx2 >= "E10" and ov.dx2 <= "E148")
or (ov.dx3 >= "E10" and ov.dx3 <= "E148")
or (ov.dx4 >= "E10" and ov.dx4 <= "E148")
or (ov.dx5 >= "E10" and ov.dx5 <= "E148") )
หากไม่ต้องการให้ HN ซ้ำแก้ไขตรงไหนครับ