BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: panus_t ที่ กรกฎาคม 07, 2011, 10:32:16 AM
-
ขอคำสั่ง SQL ดูรายชื่อผุ้ป่วยสิทธิ์ต่างด้าวที่...แพทย์ชื่อ ก (นามสมมุติ) ตรวจที่ห้องตรวจโรค1
;D
-
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-07-01" and "2011-07-06" and ov.hn=pt.hn
and ov.age_y>= 0
and ov.age_y<= 120
and ov.pttype="51"(รหัสสิทธิแรงงานต่างด้าว)
and ovst.main_dep="010"(แผนกหลักที่ห้องบัตรส่งไป)
and ov.dx_doctor ="003" รหัสแพทย์(ตาราง doctor)
ตัวอย่างนะครับ