BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: Bond_007 ที่ พฤษภาคม 25, 2011, 10:52:50 AM
-
พอดีมีคนไข้มาใหม่่ในเดือนเมษาคนข่อนค้างมากครับ โรงพยาบาลเปิดเพิ่มมาอีกหนึ่งแผนกก็เลยเกิดความคิดแ
ละเกิดข้อสงสัยว่าจะ ตรวจสอบอย่างไรว่ามีข้อมูลอยู่ในบัณชี 1 ด้วยหรืือไม่ใช้คำสั่งนี้ตรวจสอบพบว่ามันไม่มีข้อมูลเลยครับ (ปล ผมไม่เก่งคำสั่ง sql นะครับ )
select ov.* from ovst ovก็
left outer join patient p on p.hn = ov.hn
where ov.vstdate between '2011-04-01' and '2011-04-31' and p.cid not in ( select cid from person)
-
แบบนี้ครับ
select * from vn_stat
where cid not in (select cid from person)
and vstdate between '2011-05-25' and '2011-05-26'
-
ถ้าตรวจสอบจาก cid
select distinct v.hn, concat(p.pname,p.fname," ",p.lname) as ptname, p.cid
from vn_stat v
join patient p on p.hn=v.hn
left outer join person ps on ps.cid=v.cid
where ps.cid is null and v.vstdate between '2011-01-01' and '2011-01-31'
order by p.hn
นอกจากนี้สามารถตรวจสอบจาก hn และ patient_hn ได้อีกด้วย