Women in Technology

Hear us Roar



Article:
  SQL Subqueries
Subject:   nth subquery if the records has same salary for two or three employees
Date:   2006-02-06 04:55:06
From:   onlinestudyguide
sir,
the following is the emp1 table havin
empno| empname| sal|deptno
101 |balu|6000| 101101
Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • nth subquery if the records has same salary for two or three employees
    2007-07-05 15:00:00  Poon [View]

    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;