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

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 ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

mention different types of relationships in the dbms?

1092


What is a periodical index?

978


What happens if ntwdblib.dll is missing on your machine?

1190


How to disable triggers using "disable trigger"?

1112


What is a rollup clause?

1019


What is the web service used for reporting services?

126


How to convert numeric expression data types using the cast() function?

1121


What is replication with database mirroring? : sql server database administration

1152


What is lock escalation? : sql server database administration

1200


What are the disadvantages of indexes?

1159


How do you maintain database integrity where deletions from one table will automatically cause deletions in another table?

1248


What do you mean by 'normalization'?

1123


How to return the top 5 rows from a select query in ms sql server?

1210


What are Row versions of DataRow?

1083


Explain what role entity and relationship play in an ER diagram.

1115