考虑三个表房源详细信息基于计数另一个表
- 部门
- dept_emp
- 员工
我想列出谁被分配到的部门有更多的员工超过50,000名员工。
我试过几种不同的方法使用子查询,但没有得到它的权利。
这是一次失败的尝试。注:我想细节的员工,他们是在
select
a.dept_name,
c.*
from
departments a
left outer join
dept_emp b
on
b.dept_no = a.dept_no
left outer join
employees c
on
c.emp_no = b.emp_no
where
c.emp_no
in
(select
emp_no
from
dept_emp
group by
dept_no
having
count(dept_no) > 50000
)
请张贴您的尝试 –