how to display a employee name who have more emp working under him. we can consider the default emp table
Count (*)
Collapse
X
-
-
Originally posted by oraclemkim getting the count of mgr distincly using count(mgr) and group by clause. but i have to retrive the empno of that employee.
my goes here
select mgr from (select count(mgr) cnt, mgr from emp group by mgr) e1 ;
[CODE=oracle]select empno,ename from emp
where empno=(select mgr from
(select mgr,count(empno ) from emp
where mgr is not null
group by mgr
order by count(empno) desc)
where rownum<2)[/CODE]Comment
Comment