mayur gupta


{ City } mumbai
< Country > india
* Profession * database developer / designer
User No # 3009
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 24
Users Marked my Answers as Wrong # 71
Questions / { mayur gupta }
Questions Answers Category Views Company eMail




Answers / { mayur gupta }

Question { IBM, 158739 }

how to find nth highest salary


Answer

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