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

What are the different index configurations a table can have?

914


as a part of your job, what are the dbcc commands that you commonly use for database maintenance? : Sql server database administration

870


Tell me what is the stuff and how does it differ from the replace function?

948


Which tools are available to manage SQL Azure databases and servers?

113


How column data types are determined in a view?

910


How are the exceptions handled in sql server programming?

1015


How to make a remote connection in a database?

937


What is collation sensitivity? Explain different types.

979


Why normalization is used?

972


Explain about integration services of Microsoft SQL server?

995


What is usually the first word in a sql query?

1080


Is sql server free?

881


What is plan freezing?

917


What is raid and what are different types of raid levels?

1097


What is meant by indexing?

954