select t1.dept_no ,dept_name ,title ,count(*) from dept_emp t1 left join departments t2 on t1.dept_no = t2.dept_no left join titles t3 on t1.emp_no = t3.emp_no where t1.to_date = '9999-01-01' and t3.to_date = '9999-01-01' group by 1,2,3 order by 1,3