Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find nth highest salary

Answer Posted / sanchit dubey

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 order by salary desc ) ' + ' order by salary desc '

SELECT @SQL
EXEC @SQL

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the results of running this script?

975


What is collation sensitivity? Explain different types.

1056


What is a trigger in sql server?

1229


What is the index requirement in SQL Azure?

98


Do you know what are the differences between lost updates and uncommitted dependencies?

1140


What is the difference between char, varchar and nvarchar?

1076


What is the difference between DATETIME2 and DATETIME?

1129


What is the datatype of rowid?

963


what is unique and xaml nonclustered index

1101


What is entity data services?

1117


How to delete an existing row with delete statements in ms sql server?

1151


What is sql injection? How to protect against sql injection attack?

1040


What is change data capture (cdc) feature?

1121


Where do we use trace frag?

1062


What is difference between rollback immediate and with no_wait during alter database?

1133