Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Unanswered: finding the nth highest salary

    please send me the querry for
    'selecting the nth highest salary'
    from a table containg details of
    employees in an organisation where rows are not
    entered in acending or descending order of
    the salary.

    i am using oracle 8.0.6
    Last edited by binoy_jd; 12-23-03 at 00:50.

  2. #2
    Join Date
    Dec 2003
    Noida, India.
    You can use function rank() as in eg below:

    For nth highest salary:

    select emp, sal from
    (select emp, sal, rank() over (order by sal desc) rankSal from emp)
    where rankSal = n;
    Oracle can do wonders !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts