Replace "n" with the no. u want to get the nth highest salary.
select *
from emp e1
where ( n =
( select count ( distinct ( e2.sal ) )
from emp e2
where e2.sal >=e1.sal))
Type: Posts; User: ssuvi; Keyword(s):
Replace "n" with the no. u want to get the nth highest salary.
select *
from emp e1
where ( n =
( select count ( distinct ( e2.sal ) )
from emp e2
where e2.sal >=e1.sal))
hi
i know this is too late 4 me 2 post in this thread. anyway,assuming someone may benefit from diz,
in accy 4 on campus recruitment, u hav a written test which mostly consists of aptitude from...
Query to select top nth record:
consider the table name as emp,then
select empid
from emp e1
where ( n =
( select count ( distinct ( e2.empid ) )
from emp e2
where e2.empid >=e1.empid))
I think m=0