ผู้เขียน หัวข้อ: ขอความช่วยเหลือหน่อยการใช้คิวรี่  (อ่าน 2042 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ โรงพยาบาลอัมพวา

  • Hero Member
  • *****
  • กระทู้: 654
  • Respect: 0
    • ดูรายละเอียด
ขอความช่วยเหลือหน่อยการใช้คิวรี่
« เมื่อ: พฤศจิกายน 27, 2012, 13:17:53 PM »
0
ผมเขียน คำสั้งแล้วใช้งาน ได้แต่ เป็น 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')
Admn โรงพยาบาลอัมพวา
ขึ้นระบบ 5 พ.ค. 50
อยากเก่งกับเค้ามั่งครับ
Tel.0868331387

ออฟไลน์ pop_hosxp

  • Hero Member
  • *****
  • กระทู้: 3,128
  • Respect: +38
    • ดูรายละเอียด
    • Phanomphrai Hospital
Re: ขอความช่วยเหลือหน่อยการใช้คิวรี่
« ตอบกลับ #1 เมื่อ: พฤศจิกายน 27, 2012, 13:58:38 PM »
0
เพิ่มเป็นแบบนี้ครับ

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
pop434241@gmail.com
รพ.พนมไพร จ.ร้อยเอ็ด www.phanomphrai.net