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 objects does the fn_my_permissions function reports on? : sql server security
What is a field in a table?
what is raid? : Sql server database administration
Explain system scalar functions?
What Are the Main Features of SQL Azure?
How to identify current user in ssrs report?
What is data file in computer?
Is the log file is a part of file group?
How to list all columns in a table using odbc_columns()?
What is the difference between osql and query analyzer?
When to use Inner join & when to use subquery?
Which sql server table is used to hold the stored procedure scripts?
What is a natural primary key?
What is a synonym for manipulation?
What are the different kinds of ssrs reports?