Women in Technology

Hear us Roar



Article:
  SQL Subqueries
Subject:   nth subquery if the records has same salary for two or three employees
Date:   2007-07-05 15:00:00
From:   Poon
Response to: nth subquery if the records has same salary for two or three employees

you can even solve the query like the following:
This takes care of the duplicate and also the null value in the salary column:
select employee_ssn,salary from employee e1 where (select count(*) from(select distinct salary from employee) e2 where nvl(e2.salary,0)>nvl(e1.salary,0))<&a;