1. คำสั่งตรวจสอบทันตกรรมเคลือบหลุมร่องฟัน อายุ6-12ปี รหัส icd10tm(("238703a","238703b","238703c","238703d","238703e","238703f","238703g",
"238703h","2377030","2387030") Free schedule เบิกผ่านโปรแกรม E-claim ชดเชยได้ 4 ซี่ต่อปี ไม่นับซี่ซ้ำ
คำสั่ง SQL = select patient.hn,concat(patient.pname,patient.fname," ",patient.lname) as fullname,vn_stat.age_y,opitemrece.vstdate,
dttm.name as icd10name,dttm.icd10tm_operation_code as icd10tm from patient,opitemrece,dttm,vn_stat where 
patient.hn=opitemrece.hn and opitemrece.vn=vn_stat.vn and opitemrece.icode=dttm.icode and 
dttm.icd10tm_operation_code in("238703a","238703b","238703c","238703d","238703e","238703f","238703g",
"238703h","2377030","2387030") and vn_stat.age_y >="6" and vn_stat.age_y<="12"
and opitemrece.vstdate between "2019-10-01" and "2020-09-30" order by 1,2

2. คำสั่งตรวจสอบทันตกรรมเคลือบฟลูออไรด์หลุมร่องฟัน อายุ4-12ปี รหัส icd10tm(("238703a","238703b","238703c","238703d","238703e","238703f","238703g",
"238703h","2377030","2387030") Free schedule เบิกผ่านโปรแกรม E-claim ชดเชยได้ 1 ครั้ง1ต่อปี
คำสั่ง SQL = select patient.hn,concat(patient.pname,patient.fname," ",patient.lname) as fullname,vn_stat.age_y,opitemrece.vstdate,dttm.name as icd10name,
dttm.icd10tm_operation_code as icd10tm from patient,opitemrece,dttm,vn_stat where patient.hn=opitemrece.hn and opitemrece.vn=vn_stat.vn
and opitemrece.icode=dttm.icode and dttm.icd10tm_operation_code in("2377020","2377021") and vn_stat.age_y >="4" and vn_stat.age_y<="12"
and opitemrece.vstdate between "2019-10-01" and "2020-09-30" order by 1,2

3. คำสั่งตรวจสอบทันตกรรมหญิงตั้งครรภ์ ANC รหัส icd10tm(("2330011","2330013")(รหัสใดรหัสหนึ่ง และต้องคู่กับรหัสใดรหัสหนึ่งต่อไปนี้
("2387010","2277310","2277320","2287310","2287320")
Free schedule เบิกผ่านโปรแกรม E-claim ชดเชยได้ 1 ครั้งต่อครรภ์
คำสั่ง SQL = select patient.hn,concat(patient.pname,patient.fname," ",patient.lname) as fullname,opitemrece.vstdate,opitemrece.vsttime,
opdscreen.bw,person_anc.lmp,vn_stat.pdx,vn_stat.dx0,vn_stat.dx1,vn_stat.dx2,vn_stat.dx3,vn_stat.dx4,vn_stat.dx5,vn_stat.op0,
vn_stat.op1,vn_stat.op2,vn_stat.op3,vn_stat.op4,vn_stat.op5,dttm.name as icd10name,
dttm.icd10tm_operation_code as icd10tm from person_anc,person,patient,opitemrece,dttm,vn_stat,opdscreen
where person_anc.person_id=person.person_id
and person.cid=patient.cid and patient.hn=opitemrece.hn and opitemrece.vn=vn_stat.vn
and opitemrece.vn=opdscreen.vn and opitemrece.vn=vn_stat.vn
and opitemrece.icode=dttm.icode and dttm.icd10tm_operation_code in("2330011","2330013","2387010","2277310","2277320","2287310","2287320")
and opitemrece.vstdate between "2019-10-01" and "2020-09-31" and person_anc.lmp >='2019-01-01' group by opitemrece.vn order by 1

                                    วิธีการใช้งาน SQL QUERY HOSxP