BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: naydekdee ที่ กุมภาพันธ์ 13, 2011, 13:05:37 PM
-
คนไข้รายเก่าที่มีผลน้ำตาล >130 ติดต่อกัน 3 ครั้ง แล้วมีผล HbA1c ระหว่าง 7.1-8 %
ตอนนี้เขียนได้แต่ ผลน้ำตาลอ่ะคับ ไม่รู้จะเพิ่มอย่างไร อีกต่อไป คับ รบกวนอาจารย์ช่วยดูให้หน่อย อ่ะคับ
เริ่ม งง ไ่รู้จะต่ออย่างไร
select l3.lab_order_result as total from lab_order l3
left outer join lab_head l4 on l4.lab_order_number=l3.lab_order_number
left outer join clinicmember cm on cm.hn=l4.hn
where l3.lab_items_code="275" and l4.report_date between "2010-01-01" and "2010-10-31"
and l3.lab_order_result >130
and cm.clinic="001"
order by l4.report_date
ตอนนี้ได้ ผลน้ำตาล >130 แล้ว แต่ติดต่อกัน 3 ครั้ง และมีผล HbA1c ระหว่าง 7.1-8 %
เขียนต่ออย่างไร อ่ะคับ เขียนต่อไม่เป็น แล้ว แนะนำหน่อยคับ T T..
V V"
-
ลองค้นกระทู้เก่าดูก่อนนะครับ
http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=19711.0
-
ลองค้นกระทู้เก่าดูก่อนนะครับ
http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=19711.0
เหมือนจะไม่ใช่ซะทีเด๋วคับ
คือว่าสิ่งที่ต้องการ
select count(l3.lab_order_result) as total from lab_order l3
left outer join lab_head l4 on l4.lab_order_number=l3.lab_order_number
left outer join clinicmember cm on cm.hn=l4.hn
where l3.lab_items_code="275" and l4.report_date between "2010-01-01" and "2010-10-31"
and l3.lab_order_result >130
and cm.clinic="001"
order by l4.report_date
อยากได้จำนวนคนนะคับ ว่า เกิน 130 ติดต่อกัน 3 ครั้ง กี่คน แล้ว HbA1c ผลการตรวจอยู่ ระหว่าง 7.1-8
อยู่กี่คน แต่รายงานนั้นเด๋วลองปรับดูอีกที เผื่อเชื่อมโยงกันได้ อ่ะคับ
เหอะๆ V V"