Query to get 5th Max salary [message #211488] |
Thu, 28 December 2006 23:23 |
kishore_p
Messages: 8 Registered: December 2006
|
Junior Member |
|
|
Hi,
This is kishore. Can anybody tell me how to write a query to get a 5th maximum salary from the EMP table.
Thanks and Regards,
Kishore.
|
|
|
|
|
|
Re: Query to get 5th Max salary [message #211531 is a reply to message #211488] |
Fri, 29 December 2006 04:17 |
pavan_034
Messages: 16 Registered: October 2006
|
Junior Member |
|
|
TRY THIS CODE
SELECT * FROM EMP
WHERE
&N=(SELECT COUNT(DISTINCT(SAL)) FROM EMP E
WHERE
E.SAL>=EMP.SAL);
WHEN YOU EXECUTE THIS QUERY, IT ASKS FOR THE VALUE OF N.
ENTER THE VALUE AS PER YOUR REQUIREMENT.IN YOUR CASE ENTER 5.
BYE.
|
|
|
|
|
|
|
|