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 are the different index configurations a table can have?
as a part of your job, what are the dbcc commands that you commonly use for database maintenance? : Sql server database administration
Tell me what is the stuff and how does it differ from the replace function?
Which tools are available to manage SQL Azure databases and servers?
How column data types are determined in a view?
How are the exceptions handled in sql server programming?
How to make a remote connection in a database?
What is collation sensitivity? Explain different types.
Why normalization is used?
Explain about integration services of Microsoft SQL server?
What is usually the first word in a sql query?
Is sql server free?
What is plan freezing?
What is raid and what are different types of raid levels?
What is meant by indexing?