日期:2014-05-17 浏览次数:21304 次
select dept.dno,dept.dname,employee.sex,count(*)as count_eno from employee,dept where dept.dno=employee.dno group by employee.sex,dept.dno 如果要这样写就应该是: select dept.dno,dept.dname,employee.sex,count(*)as count_eno from employee,dept where dept.dno=employee.dno group by dept.dno,dept.dname,employee.sex
------解决方案--------------------
select b.DNO,
b.dname,
t.SEX,
count(distinct t.ENO) as count_eno
from employee t ,
dept b
where t.DNO = b.DNO
group by t.sex,b.dno,b.dname
order by b.dno,t.sex ;