how to find nth highest salary
Answer Posted / mayur
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 ) '
SELECT @SQL
EXEC (@SQL)
| Is This Answer Correct ? | 24 Yes | 71 No |
Post New Answer View All Answers
What are the new features in sql server 2016?
How do I schedule a sql server profiler trace?
What is the maximum size of a row in sql server?
Differentiate between truncate vs delete in mssql?
Differentiate between a local and a global temporary table?
What is the xml datatype?
What is explicit cursors?
Which are the new data types introduced in sql server 2008?
How to get the query of a table in sql server?
Explain cursor as data base object?
What it means to be triggered?
What is the default server name for sql server?
What is the latest version of microsoft sql server?
What is sql server profiler trace data file?
How do I setup a sql server database?