how to find nth highest salary
Answer Posted / p rem satyam
This is perfect
...............................
select * from emp e1 where (N-1)=( select
count(distinct(e2.sal) from emp e2 where e2.sal > e1.sal)
where N is level of sal. suppose you want 3rd higest sal then
in place u write 3 i.e write (3-1).
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what's the difference between delete table and truncate table commands? : Sql server database administration
Tell me about pre-defined functions of sql?
How will you find out if there are expensive SQL statements running or not?
Explain powershell included in sql server 2008?
what are the new features introduced in sql server 2000? : Sql server database administration
How can we migrate from SQL server to SQL Azure?
if you encounter this kind of an error message, what you need to look into to solve this problem? : Sql server database administration
Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?
How sql server enhances scalability of the database system?
Explain the difference between primary keys and foreign keys?
Explain what is lock escalation?
What is a result set object returned by mssql_query()?
What is the security principal at the database level that represents your session?
What is Transparent Data Encryption?
How can you find out if the current user is a member of the specified microsoft® windows nt® group or microsoft sql server™ role?