0
找出第二最沒有。的員工使用emp和dept表中的dname。爲以下情況編寫一個sql查詢?
select d.dname,count(*) "totemp" from emp e,dept d
where e.deptno=d.deptno
group by (d.dname)
having count(*)=(select max(count(*)) from emp e,dept d
where e.deptno=d.deptno
group by d.dname);
此查詢將顯示最高號碼。的員工使用dname。 但我想要dname的第二高。
但這裏只DNAME顯示,但我想總沒有DNAME。員工 –
增加了'cnt'列,它就在那裏。 –
YAA感謝...... –