题解 | #汇总各个部门当前员工的title类型的分配数目#
汇总各个部门当前员工的title类型的分配数目
http://www.nowcoder.com/practice/4bcb6a7d3e39423291d2f7bdbbff87f8
SELECT t1.dept_no AS dept_no, t1.dept_name AS dept_name, t3.title AS title, COUNT(t3.title) AS count FROM departments AS t1, dept_emp AS t2, titles AS t3 WHERE t1.dept_no = t2.dept_no AND t2.emp_no = t3.emp_no GROUP BY t1.dept_no, t3.title ORDER BY t1.dept_no, t3.title