ตอนนี้ ก็ ทำมือ อยู่ครับ อยากได้เหมือนกัน 
เอาตัวนี้ไปใช้ก่อนยังไม่ได้ทำ รายงาน
จำนวนคนที่จ่ายเงินออกใบเสร็จรับเงิน 
select *
from rcpt_print_detail     r1
left outer join opitemrece o1 on o1.vn=r1.vn
   where r1.income in (select income from income where income_group="17")
   and o1.icode in (select fee_code from pttype where fee_code="3005367" )
   and o1.vstdate between "2012-09-01" and "2012-09-30"
fee_code="3005367"   คือรหัส icode ค่าใช้จ่าย ร่วมจ่าย 30 บาท  แก้ไขเป็นของแต่ละที่
จำนวนคนที่มารับบริการ ที่ได้สิทธิร่วมจ่าย (แต่ไม่จ่ายก็ได้)
select * from opitemrece   
where income in (select income from income where income_group="17")
and sum_price="30"
and pttype in (select pttype from pttype where pcode="UC" and nhso_code="89")
and icode  in (select fee_code from pttype where fee_code="3005367" )
and vstdate between "2012-09-01" and "2012-09-30"