BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: Bond_007 ที่ ตุลาคม 17, 2011, 18:49:38 PM
-
หัวหน้าผ่ายส่งเสริมต้องการรายงานการว่าในรอบปีที่ผ่านมา 1 พฤศจกยน 2553 - 30 ตุลาคม 2554 มีผู้รับบริการท่านใดได้ทำการตรวจ HBAC มากกว่าหนึ่งครั้งขอบคุณครับ
-
ไม่รู้แบบนี้จะถูกไหมครับ
select l.hn,p.pname,p.fname,p.lname from lab_head l
left outer join patient p on p.hn = l.hn
left outer join lab_order o on l.lab_order_number = o.lab_order_number
where l.order_date between '2010-10-01' and '2011-10-31' and o.lab_items_code = "185" and l.hn in (select hn from clinicmember where clinic = 001 )
group by l.hn
having count(o.lab_items_code = "185") > 1