ต้องการหาข้อมูลผู้ป่วยเบาหวานรายใหม่ในปี หน่อยครับ
ผมมีอยู่ 2 code ไม่รู้ว่าอันไหนถูก
code 1
----------------------------------------------------------
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 "2011-01-01" and "2011-05-25" and ov.hn=pt.hn
and ov.age_y>= 0
and ov.age_y<= 200
and ( (ov.pdx >= "e10" and ov.pdx <= "e149")
or (ov.dx0 >= "e10" and ov.dx0 <= "e149")
or (ov.dx1 >= "e10" and ov.dx1 <= "e149")
or (ov.dx2 >= "e10" and ov.dx2 <= "e149")
or (ov.dx3 >= "e10" and ov.dx3 <= "e149")
or (ov.dx4 >= "e10" and ov.dx4 <= "e149")
or (ov.dx5 >= "e10" and ov.dx5 <= "e149") )
--------------------------------------------------------------------
code 2
----------------------------------------------------------------------
select count(c.hn)
from clinicmember c
where c.regdate between "2011-01-01" and "2011-05-31" and c.clinic = "001"
order by c.regdate,c.number
-----------------------------------------------------------------------