View previous topic :: View next topic
|
Author |
Message |
gvel19
New User
Joined: 20 Jul 2008 Posts: 19 Location: Schenactady, US
|
|
|
|
Hi,
1) I need a SQL query to fetch the 3rd maximum salary from a table.
2) Also need to get the list of employees (From table A) whose salary is greater than the average salary of the employees from another table (table B).
Thanks,
Vel |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
Vel, this is a forum not a software factory, it would be good if you could post what you have tried so far. |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
To select the third max. You can try this.
Code: |
SELECT MAX(Sal) FROM tablename
WHERE Sal <(SELECT MAX(Sal) FROM tablename
WHERE Sal < (SELECT MAX(Sal) FROM tablename));
|
|
|
Back to top |
|
|
gvel19
New User
Joined: 20 Jul 2008 Posts: 19 Location: Schenactady, US
|
|
|
|
Thanks a lot birdy.
Acevedo : I'm extremely sorry for that. I have tried but didn't get any hint for the query. |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
Back to top |
|
|
|