BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: thecoy ที่ มิถุนายน 15, 2009, 11:33:40 AM
-
select o.vstdate ,count(o.vn) as morning ,count(a.vn) as afternoon ,count(b.vn) as nigth
from ovst o
left outer join ovst a on a.vn=o.vn and a.vsttime between'16:00:00' and '23:59:59'
left outer join ovst b on b.vn=o.vn and b.vsttime between'00:00:00' and '07:59:59'
where o.vstdate between '2009-05-01' and'2009-05-31'
and o.vsttime between'08:00' and '15:59:59'
group by o.vstdate
:Dมันออกจะเฉพาะ ช่วงเช้า ครับ บ่ายกับดึกไม่ออก :D
-
select o.vstdate
,count(o.vn) as amount
,sum(o.vsttime between '08:00:00' and '15:59:59') as morning
,sum(o.vsttime between '16:00:00' and '23:59:59') as afternoon
,sum(o.vsttime between '00:00:00' and '07:59:59') as nigth
from ovst o
where o.vstdate between '2009-05-01' and'2009-05-31'
group by o.vstdate
-
Thank you :D
-
อันนี้มันผู้ป่วยนอกนิครับ ;D
-
อันนี้มันผู้ป่วยนอกนิครับ ;D
หายอดจำนวนผู้ป่วย ในแต่ละช่วงเวลา
;D