查詢每一個部門工資最低的兩個員工的編號,姓名,工資

select deptno, ename, sal from emp e1 where ( select count(*) from emp e2 where e2.deptno=e1.deptno and e2.sal<e1.sal ) <2 order by deptno, sal;
相關文章
相關標籤/搜索