how to find nth highest salary
Answer Posted / vidit
DECLARE @SQL VARCHAR(2000), @N INT
SET @N = 5
SET @N = @N - 1
SET @sql = 'select top 1 salary from ABC where salary not
in ( SELECT TOP ' + CAST(@n AS VARCHAR(100)) + ' salary
FROM ABC order by salary desc ) ' + ' order by salary desc '
SELECT @SQL
EXEC @SQL
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What authentication modes does sql server support?
What do you understand by mirroring and mention the advantages of the mirroring?
What are the system database in sql server 2005?
Hi, I Created 3 Tables Person(PersID[prkey],Name,Email,Password), Project(ProjName,ProjID[prkey],ProjLeader,ProjManager) & ProjectInvolvement(EntryDate,ProjID[frkey],PersID[frkey],ProjDuration). For this how can i INSERT,UPDATE & DELETE Through PROCEDURE? Please Post the Answer for me. Desai.
optimization techinques
When a primary key constraint is included in a table, what other constraints does this imply?
What are the security related catalog views? : sql server security
What is SQL Azure Federations?
what are isolation levels? : Sql server database administration
What are different types of statements that are supported by sql?
Explain external key management in sql server 2008
How to connect php with different port numbers?
Please illustrate physical database architecture? : SQL Server Architecture
What is plan freezing?
What are the 10 characteristics of data quality?