BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: shukree ที่ มีนาคม 17, 2013, 01:40:27 AM
-
ขอคำสั่ง sql เพื่อดึงข้อผู้ป่วยที่มีการสั่งใช้ยาที่เป็นคู่ DI ในช่วงวันที่ ***** โดยอิงจากแฟ้ม Drug_interaction ครับ
-
select dii.drugname1, dii.drugname2, dii.note, count(dii.vn) as cases, "OPD" as type
from drug_interaction_incident dii
join ovst o on o.vn=dii.vn
where o.vstdate between "2012-10-01" and "2013-02-28"
group by dii.drugname1, dii.drugname2
union
select dii.drugname1, dii.drugname2, dii.note, count(dii.vn) as cases, "IPD" as type
from drug_interaction_incident dii
join ipt_order_no i on i.order_no=dii.order_no
where i.rxdate between "2012-10-01" and "2013-02-28"
group by dii.drugname1, dii.drugname2
order by type, cases desc
-
ขอบคุณครับ
-
ถ้าจะตรวจสอบจากตาราง opitemrece ไม่ทราบว่าคำสั่งอย่างไรครับ
-
เพื่อ ??? ???
-
พอตรวจสอบใน Drug_interaction_incedent แล้ว ปี 53 54 54 ค่าที่ได้กระโดดมาก จากร้อยกว่า เป็น 2 พันกว่า ในขณะที่ไม่ได้แก้ไขแฟ้ม drug_interaction เลย