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

CREATE TABLE
[dbo].[Table_1]([ID] [int] NOT NULL,[SAL] [int] NULL)

//N=9
SELECT TOP 1 * FROM dbo.Table_1
WHERE ID NOT IN (SELECT TOP 8/*N-1*/ ID FROM dbo.Table_1
ORDER BY SAL DESC)
ORDER BY SAL DESC

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a functions and types in sql server?

1150


What are tables in sql server?

1098


What is table valued function and scalar valued functions?

1166


What is create statement?

1010


What happens if the update subquery returns multiple rows in ms sql server?

1171


What is the beast way to write CTE in SQL Server ?

1096


You accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover?

1039


How adventureworkslt tables are related?

984


What is a View ? Can we insert, Update and delete a view?

1064


What programming language would you use to create embedded functions in ssrs?

191


What is a unique index?

974


Explain Normalization and DE normalization

1160


How to concatenate two binary strings together?

1175


What are the main differences between #temp tables and @table variables and which one is preferred?

1135


Which autogrowth database setting is good?

1096