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 objects does the fn_my_permissions function reports on? : sql server security

1086


What is a field in a table?

1075


what is raid? : Sql server database administration

1088


Explain system scalar functions?

1046


What Are the Main Features of SQL Azure?

121


How to identify current user in ssrs report?

408


What is data file in computer?

1002


Is the log file is a part of file group?

1096


How to list all columns in a table using odbc_columns()?

1035


What is the difference between osql and query analyzer?

1048


When to use Inner join & when to use subquery?

1238


Which sql server table is used to hold the stored procedure scripts?

1111


What is a natural primary key?

1110


What is a synonym for manipulation?

1049


What are the different kinds of ssrs reports?

221