题解 | #统计各个部门的工资记录数#
统计各个部门的工资记录数
http://www.nowcoder.com/practice/6a62b6c0a7324350a6d9959fa7c21db3
使用表关联和子查询链接 select a.dept_no,a.dept_name, count(d.salary) from departments a left join dept_emp b on a.dept_no=b.emp_no left join (select a.dept_no,c.* from dept_emp a inner join salaries c on a.emp_no=c.emp_no) as d on a.dept_no=d.dept_no group by a.dept_no,a.dept_name;