.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

How to get the nth highest value from SQL Server

Posted By: Ramesh     Posted Date: January 27, 2010    Points:2   Category :Sql Server
Hi,

I have a question how to get the nth highest value from SQL Server?

For example i want to get the 5th highest value from database.

Also if possible how to fetch the nth lowest value from database?

Regards
Ramesh

Responses
Author: Lalij Mer             
Posted Date: January 28, 2010     Points: 5   
Author: Syed Shakeer Hussain             
Posted Date: January 28, 2010     Points: 5   

Hi
SELECT MIN(sal) FROM emp WHERE sal IN (SELECT  distinct TOP 5  sal FROM emp ORDER BY sal DESC)


Author: Nikhil             
Posted Date: January 29, 2010     Points: 5   

SELECT TOP(1) FROM
(
Select Top(10) FName, LName, Salary From emp
)
as Temp



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend