题解 | #汇总各个部门当前员工的title类型的分配数目#
汇总各个部门当前员工的title类型的分配数目
http://www.nowcoder.com/practice/4bcb6a7d3e39423291d2f7bdbbff87f8
SELECT A.dept_no, B.dept_name, C.title, COUNT( title ) AS count FROM dept_emp AS A LEFT JOIN departments AS B ON A.dept_no = B.dept_no LEFT JOIN titles C ON A.emp_no = C.emp_no WHERE C.title IS NOT NULL GROUP BY A.dept_no, B.dept_name, C.title ORDER BY A.dept_no asc, C.title asc;