select pc.hcode,pc.name as pcuname,count(v.vn) as con,count(r.vn) as conrefer,
sum(v.income) as income
from vn_stat v
left outer join pttypeno p on v.hn=p.hn
left outer join referout r on r.vn=v.vn
left outer join pcu_child pc on pc.hcode=p.hospsub
where v.vstdate between '2009-10-1' and '2010-09-30'
and v.pttype between "60" and "98" and pc.hcode <> ""
group by pc.hcode
ลองเล่นดูนะคะ