Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on List all the job groups who average salary exceeds that of managers. within the SQL Server forums, part of the Databases category; List all the job groups who average salary exceeds that of managers. Empno ename job manager hiredate salary deptno commission 7369 smith clerk 7902 12/1/1982 1200 20 null 7499 allen ...
|
|||||||
| SQL Server SQL Server is a Database Management System(DBMS) by Microsoft |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|||
|
List all the job groups who average salary exceeds that of managers.
List all the job groups who average salary exceeds that of managers.
Empno ename job manager hiredate salary deptno commission 7369 smith clerk 7902 12/1/1982 1200 20 null 7499 allen salesman 7698 2/20/1981 1501 30 null 7521 ward salesman 7698 2/22/1981 1600 30 160 7698 black manager 7999 5/1/1981 3850 30 385 7902 ford analyst 7566 12/1/1981 3000 10 300 7688 jones analyst 7698 10/10/2008 4500 10 450 7689 martin clerk 7698 12/12/2004 4525 20 453 7999 scott ceo null 1/1/2001 9999 30 1000 7466 tiger manager 7999 1/1/2004 6500 10 650 Last edited by debasisdas; 04-28-2009 at 10:58 AM. Reason: formatted |
| Sponsored Links |
|
|||
|
Re: List all the job groups who average salary exceeds that of managers.
Hi Jai,
The query can be like Select AvgSal, job from ( select avg(salary) AvgSal, job from [tablename] group by job ) as vw where job<>'manager' and AvgSal > (Select Avg(Salary) from [tablename] where job='manager') ---V V--- Vikas Vaidya |
|
|||
|
Re: List all the job groups who average salary exceeds that of managers.
Select job,avg(salary)from employees where (avg(salary)>(select salary from employees where job=manager) and job not equals 'manager') group by job.
|
|
|||
|
Re: List all the job groups who average salary exceeds that of managers.
Select job,avg(salary)from employees where (avg(salary)>(select salary from employees where job=manager) and job not equals 'manager') group by job;
|
|
|||
|
Re: List all the job groups who average salary exceeds that of managers.
Select job, avgsal
From (Select Avg (sal) avgsal, job From emp Group By job), (Select sal msal From emp Where job = 'MANAGER') Where avgsal > msal And job != 'MANAGER'
__________________
Sireesha |
|
|||
|
Re: List all the job groups who average salary exceeds that of managers.
select job, avg(sal ) from emp where job != "MANAGER" group by job
having avg(sal ) > ( select avg(sal) from emp where job = "MANAGER" ) |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to display 3rd highest salary to 5th highest salary from emp table | kirandstyle | SQL | 4 | 02-18-2009 09:22 AM |
| what s da manager of managers out of concurrent managers | sudhakar83.p | Oracle | 1 | 07-16-2008 09:42 AM |
| Average Salary | smart_coder | Brainteasers | 3 | 11-03-2007 11:29 AM |
| what is the average speed ? | psuresh1982 | Brainteasers | 4 | 01-04-2007 04:51 AM |
| what is the average speed? | psuresh1982 | Brainteasers | 2 | 11-28-2006 08:27 AM |