ช่วยดูหน่อยครับว่าผมเขียนรายงานดึงผู้ป่วยรายใหม่แบบนี้ถูกป่าว
รายงานผู้ป่วย asthma รายใหม่ปีงบ 56
select distinct(ov.hn), concat(pname, fname," ",lname) as name, ov.age_y, pt.informaddr, ov.pdx, ov.dx0,ov.dx1,ov.dx2,ov.dx3,ov.dx4,ov.dx5
from vn_stat ov ,patient pt ,ovst ovst
where ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2012-10-01" and "2013-09-30" and ov.hn=pt.hn
and ov.age_y>= 0
and ov.age_y<= 200
and ( (ov.pdx >= "J459" and ov.pdx <= "J46")
or (ov.dx0 >= "J459" and ov.dx0 <= "J46")
or (ov.dx1 >= "J459" and ov.dx1 <= "J46")
or (ov.dx2 >= "J459" and ov.dx2 <= "J46")
or (ov.dx3 >= "J459" and ov.dx3 <= "J46")
or (ov.dx4 >= "J459" and ov.dx4 <= "J46")
or (ov.dx5 >= "J459" and ov.dx5 <= "J46") )