62,046
社区成员
发帖
与我相关
我的任务
分享
select y_num_e,m_num_e,deptname from
(
select sum(re_c.rdlc_num) y_num_e,'' as m_num_e,de.deptname from REPORTVIEWER_count re_c left join hum_list h on re_c.user_id=h.human_sid
inner join department de on de.dept_id=h.dept_id
inner join s_hse_ticket s on s.reghumsid=h.human_sid
where to_char(re_c.create_date,'yyyy')=to_char(sysdate,'yyyy') and s.erifystate='完成'
group by re_c.rdlc_num,de.deptname
union all
select '' as y_num_e ,sum(re_c.rdlc_num) m_num_e,de.deptname from REPORTVIEWER_count re_c left join hum_list h on re_c.user_id=h.human_sid
inner join department de on de.dept_id=h.dept_id
inner join s_hse_ticket s on s.reghumsid=h.human_sid
where to_char(re_c.create_date,'mm')=to_char(sysdate,'mm') and s.erifystate='完成'
group by re_c.rdlc_num,de.deptname
)