题解 | #汇总各个部门当前员工的title类型的分配数目#
汇总各个部门当前员工的title类型的分配数目
https://www.nowcoder.com/practice/4bcb6a7d3e39423291d2f7bdbbff87f8
select t1.dept_no, t1.dept_name, t3.title, count(title) `count` from departments t1 inner join dept_emp t2 on t1.dept_no = t2.dept_no inner join titles t3 on t2.emp_no = t3.emp_no where t2.to_date = '9999-01-01' and t3.to_date = '9999-01-01' group by t1.dept_no,t1.dept_name,t3.title order by t1.dept_no,t3.title;