题解 | #汇总各个部门当前员工的title类型的分配数目#

汇总各个部门当前员工的title类型的分配数目

http://www.nowcoder.com/practice/4bcb6a7d3e39423291d2f7bdbbff87f8

这个题目注意分组时使用了属性组

select emp.dept_no, emp.dept_name, titles.title, count(emp.dept_no) from 
(select b.emp_no, a.dept_no, a.dept_name 
from departments a , dept_emp b 
where a.dept_no = b.dept_no ) as emp 
inner join titles on titles.emp_no = emp.emp_no 
group by titles.title, emp.dept_no order by emp.dept_no
全部评论

相关推荐

仁者伍敌:难怪小公司那么挑剔,让你们这些大佬把位置拿了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务