... ลองแบบนี้ก็ได้ครับพี่วินัย
select concat(pt.addrpart," ม.",pt.moopart ," ",t.full_name) as full_address,
pt.*,ov.*
from ovst ovst,patient pt,vn_stat ov
left outer join thaiaddress t on ov.aid = t.addressid
where ov.vstdate between "2011-01-01" and "2011-01-10"
and ov.vn=ovst.vn and ov.hn=pt.hn
and ov.age_y>= 0 and ov.age_y<= 200
and ( (ov.pdx >= "C000" and ov.pdx <= "C979")
or (ov.dx0 >= "C000" and ov.dx0 <= "C979")
or (ov.dx1 >= "C000" and ov.dx1 <= "C979")
or (ov.dx2 >= "C000" and ov.dx2 <= "C979")
or (ov.dx3 >= "C000" and ov.dx3 <= "C979")
or (ov.dx4 >= "C000" and ov.dx4 <= "C979")
or (ov.dx5 >= "C000" and ov.dx5 <= "C979") )