How we can findout the Nth largest No from the table.

sivaji

• Sep 6th, 2006

select distinct sal from emp e where &n=(select count(distinct sal) from emp where e.sal<=sal);

piper

• Oct 3rd, 2006

SELECT salary FROM employee ORDER BY salary LIMIT n-1, 1

himanshu

• Oct 6th, 2006

is there any easier way of findin the solution..this query is too confusing... :)

ddkdhar Profile Answers by ddkdhar Questions by ddkdhar

• Feb 12th, 2007

WHAT IS NTH LARGEST IN THE SENSE .YOU WANT NTH LARGEST SALARY .YOU WANT ANY ANY OTHER THING .YOU SHOULD GIVE SOME SPECIFICATION .IN ORACLE YOU CAN FIND USINGROWNUM FUNCTION MINUS OPERATORLEVEL PSEUDO CLOLUMNINLINE VIEWSUSING ANALYTICA FUNCTIONS LIKE DENSE_RANK() ROWNUM()RANK()IF YOU WANT TO FIND USE PARTITION IN ANALATYTICAL FUNCTIONS TO KNOW MORE SEARCH IN ASKTOM PORTAL

• Feb 19th, 2007

+

Select min ( sal ) from ( select distinct sal from emp order by sal desc ) where rownum < ( n + 1 )

Geetha

• Nov 5th, 2007

Select distinct sal from emp e where &n=(select count(distinct sal) from emp where e.sal>=sal);

• Nov 11th, 2008

select distinct sal from emp e where &n=(select count(distinct sal) from emp where e.sal<=sal);