select ano,sum(nvl(dmoney,0)) summoney from( select t2.ano,d.dmoney from ( select t1.*,c.cno from( select a.ano,b.bno from t_a a left join t_b b on a.ano=b.ano )t1 left join t_c c on t1.bno=c.bno )t2 left join t_d d on t2.cno=d.cno )group by ano;