SQL l连表查询 求大神帮忙看看

紫九 紫九 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
select y_num_e,m_num_e,deptname from
(
select sum(re_c.rdlc_num) y_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 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
)
如上 报错m_num_e标识符无效 单查询只有字段y_num_e,deptname 原来这样做没出现过这样的问题
请各位大神看看是不是哪写错了
...全文

相关推荐

评论 17
收藏 已收藏
分享
返回顶部
紫九
.NET社区 62,271 成员 668,968 内容