ผู้เขียน หัวข้อ: ขอคำแนะนำค่ะ  (อ่าน 4414 ครั้ง)

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

ออฟไลน์ vamas

  • Newbie
  • *
  • กระทู้: 10
  • Respect: 0
    • ดูรายละเอียด
ขอคำแนะนำค่ะ
« เมื่อ: พฤษภาคม 20, 2008, 10:51:08 AM »
0
พอดีอยากได้แนวการเขียน 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