BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: natch2005 ที่ กุมภาพันธ์ 11, 2009, 16:15:44 PM
-
คือ ถ้าจะหาข้อมูลการตรวจคนไข้รายแรกของหมอแต่ละคน ว่าเริ่มตรวจเวลากี่โมงของแต่ละวัน ต้อง query ตารางใหน อย่างงไรครับ ขอบคุณครับ
-
... ลองใช้คำสั่งข้างล่างน่าจะได้นะครับ ....
select o.vstdate,o.doctor as Doctor_Code,d.name as Doctor_Name,min(s.service5) as 1stPT_Time
from ovst o
left outer join service_time s on s.vn = o.vn
left outer join doctor d on d.code = o.doctor
where o.vstdate between '2009-02-01' and '2009-02-10'
and s.service5 is not null
group by o.vstdate,o.doctor
... :D ...