185. Department Top Three Salaries

问题描述

解决方案

 select b.name Department,a.name Employee,a.salary Salary 
 from Employee a,Department b 
 where a.departmentid=b.id and  
        (select count(distinct salary) 
            from Employee 
            where departmentid=a.departmentid and salary>a.salary
        )<3 
 order by departmentid asc,salary desc   ;

参考资料

posted @ 2016-08-11 17:40  弦断  阅读(175)  评论(0编辑  收藏  举报