BMS-HOSxP Community
HOSxP => MySQL => ข้อความที่เริ่มโดย: panus_t ที่ กุมภาพันธ์ 06, 2014, 16:42:47 PM
-
ต้องการดึงข้อมูลจาก Patient ตามช่วงเวลาที่มารับบริการใน OVST ครับ
ช่วยแก้ไข Code ให้หน่อยครับ
select p.hn,p.cid,p.pname,p.fname,p.lname,p.birthday,p.sex,p.pttype,ptt.hospmain
from ovst o
left outer join patient p on p.hn=(select hn from ovst where o.vstdate between "2012-10-01" and "2012-10-02" group by hn)
left outer join pttypeno ptt on ptt.pttype=p.pttype
;D
แล้วถ้าต้องการให้เพิ่มคอลัมน์แรก แล้วมีข้อมูลเป็น 1234(เลขสมมุติ) ทุกเรคคอร์ด ทำไงครับ
-
select p.hn,p.cid,p.pname,p.fname,p.lname,p.birthday,p.sex,p.pttype,ptt.hospmain
from ovst o
left outer join patient p on p.hn=o.hn
left outer join pttypeno ptt on ptt.pttype=p.pttype
where o.vstdate between "2016-12-01" and "2016-12-01"
group by hn
ทดลองคำสั่งนี้ครับ
ศักดิ์สิทธิ์ ซานอก
เจ้าหน้าที่ชำนาญการติดตั้งระบบและดูแลหลังการขาย