sql - Get the minimum employees with a given job -


i have table:

name                       null?    type -------------------------- -------- ------------ employeeno                 not null number(4) ename                               varchar2(15) job                                 varchar2(15) mgr                                 number(4) hiredate                            date sal                                 number comm                                number deptno                              number(2). 

i want department minimum employees have given job (for example employees 'analyst' job).

can please me query?

here key count of employee doing particular job in each department. in below query, achieved subquery. then, want department minimum no. of employee doing job ordered records returned subquery in ascending , select first result using rownum = 1

select deptno ( select count(*) no_of_emp , deptno employee emp emp.jobname = 'analyst' group deptno order no_of_emp asc ) rownum = 1;


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -