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 do I need to start working with sql studio? : sql server management studio
What is NOT NULL Constraint in sql server 2012?
What is etl - extraction, transformation, and loading?
Explain an incremental backup?
What is the difference between count () and rowcount ()?
Can you pass expressions to stored procedure parameters?
What do you mean by a dependent functionality in a build?
What is replication with database mirroring? : sql server database administration
how you can configure a running aggregate in SSRS?
what is the information that can be stored inside a bit column? : Sql server database administration
Explain what is the difference between union and union all?
How can you ensure that the database and sql server based application perform well?
What are parameterized reports? What are cascading parameters in ssrs reports?
How efficient you are in oracle and SQL server?
Can a unique index be created on a column, which contains null?