(select max(sal) from emp group by deptno) maxSal,(select min(sal) from emp group by deptno),这两列里出来的最大最小值,未必是对应的deptno的,而是所有部门的最大最小值,
这么改:
select a.deptno, (select max(sal) from emp where deptno=a.deptno) maxSal,(select min(sal) from emp where deptno=a.deptno) minSal
from emp a
order by a.deptno desc本回答被提问者采纳