วันอังคารที่ 23 ธันวาคม พ.ศ. 2557

จำนวนเป้าหมายฉีดวัคซีน dTC พร้อมผลงานและค่าร้อยละ

select village.villno as villno ,village.villname as villname,
count(distinct p.pid) as pop,
count(distinct case when visitepi.vaccinecode = 'Dtc' then visitepi.pid else null end) as ผลงาน,
concat(round(count(distinct case when getAgeYearNum(p.birth,current_date)between '20' and '50' and visitepi.vaccinecode = 'Dtc' then p.pid else null end)*100 / count(distinct case when getAgeYearNum(p.birth,current_date)between '20' and '50' then p.pid else null end),2),' %') as 'ร้อยละ'
from person p
inner join house on p.hcode = house.hcode and p.pcucodeperson = house.pcucode
inner join village on house.villcode= village.villcode and villno <> '00'
left join visitepi on p.pcucodeperson = visitepi.pcucodeperson and p.pid = visitepi.pid
and dateepi between '2014-10-01'and '2015-09-30'
where getAgeYearNum(p.birth,current_date)between '20' and '50' and p.typelive in ('1','3')
group by villno,villname


Cr.ลุงหนวด หมออนามัย

Share this

0 Comment to "จำนวนเป้าหมายฉีดวัคซีน dTC พร้อมผลงานและค่าร้อยละ"

แสดงความคิดเห็น