select department,employee_name,salary from (select department,employee_name,salary, rank() over (partition by department order by salary desc) as paiming from employees ) as t1 where t1.paiming<=2 order by department asc ;
department是asc纯属跟着效果来的,题目描述笑死,还降序