Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query to fetch employee above manager salary

Author  Topic 

sqlamith
Starting Member

2 Posts

Posted - 2011-02-27 : 21:55:19
Hello,

I am new to query programming. I am working on one assignment.

Question:
This table has employee list with their salary and their managers.

Select all the empid's whose salary is greater than their managers

empid salary manager emp id
1000 10000 1004
1001 20000 1004
1003 30000 1004
1004 25000 1005
1005 24000 1006
1006 40000 ----

Select all the empid's whose salary is greater than their managers.

Would appreciate any suggestions/response.

Thanks,
am

sqlamith
Starting Member

2 Posts

Posted - 2011-02-27 : 22:04:45
Hello,

I am new to query programming. I am working on one assignment.

Question:
This table has employee list with their salary and their managers.

Select all the empid's whose salary is greater than their managers

empid salary manager emp id
1000 10000 1004
1001 20000 1004
1003 30000 1004
1004 25000 1005
1005 24000 1006
1006 40000 ----

Select all the empid's whose salary is greater than their managers.

Would appreciate any suggestions/response.

Thanks,
am
Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2011-02-27 : 23:16:49
quote:
Originally posted by sqlamith

Hello,

I am new to query programming. I am working on one assignment.

Question:
This table has employee list with their salary and their managers.

Select all the empid's whose salary is greater than their managers

empid salary manager emp id
1000 10000 1004
1001 20000 1004
1003 30000 1004
1004 25000 1005
1005 24000 1006
1006 40000 ----

Select all the empid's whose salary is greater than their managers.

Would appreciate any suggestions/response.

Thanks,
am



Can you show us what you have tried.

You will get idea on how to start by having a look at following weblink:
http://en.wikipedia.org/wiki/Correlated_subquery
Go to Top of Page
   

- Advertisement -