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 / 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


Please Help Members By Posting Answers For Below Questions

What is molap and its advantage? : sql server analysis services, ssas

931


Comment,Datatypes are unlimited

2020


On a windows server 2003 active – passive failover cluster, how do you find the node which is active?

1163


what is raid and what are different types of raid configurations? : Sql server database administration

976


What is de-normalization in sql database administration? Give examples?

927


What is dimension table? : sql server analysis services, ssas

976


How to check status of stored procedure in sql server?

914


Does index slows down insert statements?

940


How optimize sql query with multiple joins in sql server?

829


How many joins in sql server?

901


What is 5nf in normalization form?

937


How to scale out a federation by Sql statement?

116


What are pessimistic lock and optimistic lock?

1000


What is a partition key?

889


What is the difference between composite index and covering index?

902