BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: Manit ที่ กรกฎาคม 07, 2010, 09:20:40 AM

หัวข้อ: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: Manit ที่ กรกฎาคม 07, 2010, 09:20:40 AM
จนท. PCU อยากได้รายงานจำนวนอัตราการวางแผนครอบครัว ที่ดึงข้อมูลมาจากบัญชี6น่ะครับ

หน้าตามแบบที่แนบมครับ อ.ท่านใด มีก็ขออนุเคราะห์หน่อยครับ  ;D
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: Bond_007 ที่ กรกฎาคม 07, 2010, 16:23:22 PM
ขอบคุณครับ
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: nongpangs ที่ กรกฎาคม 07, 2010, 16:37:06 PM
  ขอบคุณครับ
ยังไม่มีใครขอมาหรอก แต่ เสนอให้ก่อนเขาคงไม่ปฏิเสธกลับมาหรอกนะครับ
  หรือว่าที่ไหนปธิเสธในสิ่งที่ผู้หวังดีมอบให้
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: artwan ที่ กรกฎาคม 23, 2010, 10:58:56 AM
ขอด้วยคนครับท่าน

ขอขอบคุณล่วงหน้าเลยครับ อาจารย์
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: saiphon ที่ กรกฎาคม 23, 2010, 13:31:29 PM
แบบนี้คงพอใช้ได้นะครับ
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: artwan ที่ สิงหาคม 02, 2010, 09:15:25 AM
ขอบคุณ saiphon แต่พอดีผมทำได้ก่อนแล้วครับ ขอบคุณ
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: Orgsm ที่ มกราคม 03, 2014, 11:00:45 AM
รบกวนขอแบบที่เลือกช่วงวันที่ได้ ได้รึเปล่าคับ
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: Terminator2015 ที่ มกราคม 03, 2014, 11:47:23 AM
 :)
รบกวนขอแบบที่เลือกช่วงวันที่ได้ ได้รึเปล่าคับ

มีแบบนี้ ลองทดสอบดู
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: Orgsm ที่ มกราคม 03, 2014, 12:02:04 PM
ขอบคุณมากครับ เดี่ยวจะขอทดสอบดู
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ มกราคม 03, 2014, 12:05:24 PM
ลองแบบนี้ได้อีกแบบครับ
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: woravet ที่ มกราคม 03, 2014, 14:45:53 PM
set @ds1:='2012-10-1';
set @ds2:='2013-9-30';
select cast(a.village_moo as decimal) moo,a.village_name name,b.*
,if(b.target=0,0,b.total/b.target*100) percent
from village a
left join (select v.village_id
,count(distinct p.cid) target
,count(distinct if(s.women_service_id=1 and s.women_birth_control_id>0,s.person_women_service_id,null)) total
,count(distinct if(s.women_birth_control_id=0 or s.women_birth_control_id is null,s.person_women_service_id,null)) FP0
,count(distinct if(s.women_birth_control_id=1,s.person_women_service_id,null)) FP1
,count(distinct if(s.women_birth_control_id=2,s.person_women_service_id,null)) FP2
,count(distinct if(s.women_birth_control_id=3,s.person_women_service_id,null)) FP3
,count(distinct if(s.women_birth_control_id=4,s.person_women_service_id,null)) FP4
,count(distinct if(s.women_birth_control_id=5,s.person_women_service_id,null)) FP5
,count(distinct if(s.women_birth_control_id=6,s.person_women_service_id,null)) FP6
,count(distinct if(s.women_birth_control_id=7,s.person_women_service_id,null)) FP7
from person p
left join village v on p.village_id=v.village_id
left join person_women w on p.person_id=w.person_id
left join person_women_service s on w.person_women_id=s.person_women_id and s.service_date between @ds1 and @ds2 and s.women_service_id=1
where p.sex=2
and p.marrystatus=2
and p.house_regist_type_id in (1,3)
and timestampdiff(year,p.birthdate,@ds1) between 15 and 44
group by v.village_id) b on a.village_id=b.village_id
order by 1
หัวข้อ: Re: ขอรายงานจำนวนอัตราการวางแผนครอบครัวหน่อยครับ
เริ่มหัวข้อโดย: woravet ที่ มกราคม 03, 2014, 14:49:34 PM
set @ds1:='2012-10-1';
set @ds2:='2013-9-30';
select a.women_birth_control_id id,a.women_birth_control_name name
,ifnull(b.cc,0) Total
,ifnull(b.incase,0) incase
,ifnull(b.invisit,0) invisit
,ifnull(b.outcase,0) outcase
,ifnull(b.outvisit,0) outvisit
from women_birth_control a
left join (select s.women_birth_control_id,count(*) cc
,count(distinct if(v.village_moo<>0,p.cid,null)) incase
,count(if(v.village_moo<>0,p.cid,null)) invisit
,count(distinct if(v.village_moo=0,p.cid,null)) outcase
,count(if(v.village_moo=0,p.cid,null)) outvisit
from person_women_service s
left join person_women w on w.person_women_id=s.person_women_id
left join person p on p.person_id=w.person_id
left join village v on p.village_id=v.village_id
where s.service_date between @ds1 and @ds2
and s.women_service_id=1
group by s.women_birth_control_id) b on a.women_birth_control_id=b.women_birth_control_id
where a.women_birth_control_id>0
order by 1