BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: โรงพยาบาลอัมพวา ที่ พฤศจิกายน 27, 2012, 13:17:53 PM
-
ผมเขียน คำสั้งแล้วใช้งาน ได้แต่ เป็น main_dep เป็น 002 มันขึ้น error ทุกทีอ่ะครับ
select s.hn, s.vstdate, s.vsttime, s.service7 as finishexam,
sec_to_time(time_to_sec(service7)-time_to_sec(service3)) as timefromvsttime2finishexam
from service_time s
where s.vstdate between '2012-06-11'and '2012-06-18'
and s.service3 is not null
and s.service7 is not null
and s.vsttime >= "08:00:00" and s.service7 <= "16:00:00"
and s.vn in(select vn from ovst where main_dep ='002')
-
เพิ่มเป็นแบบนี้ครับ
select s.hn, s.vstdate, s.vsttime, s.service7 as finishexam,
sec_to_time(time_to_sec(service7)-time_to_sec(service3)) as timefromvsttime2finishexam
from service_time s
where s.vstdate between '2012-06-11'and '2012-06-18'
and s.service3 is not null
and s.service7 is not null
and s.vsttime >= "08:00:00" and s.service7 <= "16:00:00"
and s.vn in(select vn from ovst where main_dep ='002')
and s.service7>s.service3