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 are the new features in sql server 2016?

969


How do I schedule a sql server profiler trace?

983


What is the maximum size of a row in sql server?

969


Differentiate between truncate vs delete in mssql?

1085


Differentiate between a local and a global temporary table?

957


What is the xml datatype?

1083


What is explicit cursors?

1076


Which are the new data types introduced in sql server 2008?

882


How to get the query of a table in sql server?

900


Explain cursor as data base object?

1043


What it means to be triggered?

1010


What is the default server name for sql server?

1176


What is the latest version of microsoft sql server?

1047


What is sql server profiler trace data file?

1114


How do I setup a sql server database?

1078