BMS-HOSxP Community

HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: vamas ที่ พฤษภาคม 20, 2008, 10:51:08 AM

หัวข้อ: ขอคำแนะนำค่ะ
เริ่มหัวข้อโดย: vamas ที่ พฤษภาคม 20, 2008, 10:51:08 AM
พอดีอยากได้แนวการเขียน SQl ที่เป็นการจัดกลุ่มโรค
เช่นต้องการรหัส F200-F299 เป็นกลุ่มของชื่อ  F
และG400-G409 กลุ่ม ชื่อ G และกลุ่มอื่นๆๆอีกค่ะ
ลองเขียนแต่ยังขาดคำสั่งอีกน่ะค่ะ 
ขอคำแนะนำด้วยค่ะ
select pt.hn,pt.pname,pt.fname,pt.lname,ov.vstdate ,ov.pdx,pt.cid,ov.age_y
from vn_stat ov ,patient pt ,ovst ovst

where  ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2007-10-01" and  "2007-10-31" and ov.hn=pt.hn
 and ov.age_y>= 0
 and ov.age_y<= 200
 and ( (ov.pdx >= "F200" and ov.pdx <= "F299") )
group by pt.hn