select decode(t.f_disqua_level,'1','A类','2','B类','3','C类','4','D类','') as 等级, t.f_process as 发现地点, t.f_discovery_time as 发现时间, t.f_description as 不合格描述, b.f_dutydept as 责任部门, b.f_assess_multiple as 考核倍数, b.f_assess_sum as 金额(元), c.sum_count as 部门合计
from t_quality_dis_process t,t_quality_dis_dutydept b,
(select a.f_dutydept,
sum(a.f_assess_sum) OVER(PARTITION BY a.f_assess_sum) sum_count
from t_quality_dis_dutydept a
group by a.f_dutydept) c
where t.f_status=4
and b.f_disqua_id=t.f_id
and to_char(t.f_discovery_time,'yyyymm') between '201503' and '201503'
and c.f_dutydept = b.f_dutydept
order by t.f_discovery_time