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 is molap and its advantage? : sql server analysis services, ssas
Comment,Datatypes are unlimited
On a windows server 2003 active – passive failover cluster, how do you find the node which is active?
what is raid and what are different types of raid configurations? : Sql server database administration
What is de-normalization in sql database administration? Give examples?
What is dimension table? : sql server analysis services, ssas
How to check status of stored procedure in sql server?
Does index slows down insert statements?
How optimize sql query with multiple joins in sql server?
How many joins in sql server?
What is 5nf in normalization form?
How to scale out a federation by Sql statement?
What are pessimistic lock and optimistic lock?
What is a partition key?
What is the difference between composite index and covering index?