BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: nano ที่ พฤศจิกายน 05, 2012, 16:08:38 PM
-
select
pt.tmbpart,
pt.moopart,
count(distinct pt.hn) as hn_count
from vn_stat ov ,patient pt ,ovst ovst
WHERE
ov.vn = ovst.vn AND
pt.hn = ov.hn AND
ov.vstdate BETWEEN "2011-10-01" AND "2012-09-30" AND
ov.hn = pt.hn AND
ov.aid LIKE "3806%"
and ( (ov.pdx >= "N180" and ov.pdx <= "N189")
or (ov.dx0 >= "N180" and ov.dx0 <= "N189")
or (ov.dx1 >= "N180" and ov.dx1 <= "N189")
or (ov.dx2 >= "N180" and ov.dx2 <= "N189")
or (ov.dx3 >= "N180" and ov.dx3 <= "N189")
or (ov.dx4 >= "N180" and ov.dx4 <= "N189")
or (ov.dx5 >= "N180" and ov.dx5 <= "N189") )
GROUP BY
pt.tmbpart,
pt.moopart
ORDER BY
pt.tmbpart ASC,
pt.moopart ASC