SELECT
dm.dept_no,
dm.dept_name,
COUNT(*) AS sum
FROM
departments AS dm
INNER JOIN
dept_emp AS de ON dm.dept_no=de.dept_no
INNER JOIN
salaries AS s ON de.emp_no=s.emp_no
GROUP BY
dm.dept_no,
dm.dept_name
ORDER BY
dm.dept_no ASC;

京公网安备 11010502036488号