ขอ SQL 10 อันโรคทางอาชีวอนามัยหน่อยคับ 
 
 
 
เบื้องต้น  ตารางที่น่าสนใจคือ  ovstdiag/iptdiag  ครับ
และกติกาเริ่มต้นคือตามภาพประกอบครับ  คือต้องมี  icd10  in(Y96,Y97)  ที่เป็น  diagtype=5  ด้วยครับ 
ดังนั้น ลองเริ่มที่    
select * from ovstdiag   where icd10 in ('Y96','Y97')  มีหรือไม่มี  ถ้าไม่มีก็จบในมาตรฐานครับ..กับ  ลอง  
select i.icd10,count(i.an) as cc  from iptdiag  i
inner join ipt ip on ip.an=i.an
where ip.dchdate between '2013-10-01' and '2015-09-30'  and diagtype <>'5' and i.an in (select distinct an from iptdiag   where icd10 in ('Y96','Y97'))
group by i.icd10
order by cc desc limit 10    ทั้งหมดนี้คือความเห็นในเบื้องต้นนะครับ