SQL server2000 查询总人数最多的部门,列出部门名称、人数

2025-04-04 20:23:30
推荐回答(1个)
回答1:

select c.部门名称,b.人数
from(
select a.dno,sum(a.人数)as 人数
from Employee a
group by a.Dno
)b,Dept c
where c.dno = b.dno
and b.人数 = (

select max(d.人数)
from(
select a.dno,sum(a.人数)as 人数
from Employee a
group by a.Dno
)d
)