C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...









SQL Query to Find the Nth highest Colum Value in a Table.


Posted Date: 23 Jul 2008    Resource Type: Code Snippets    Category: SQL

Posted By: saji       Member Level: Gold
Rating:     Points: 2



Let us assume that we have Table with Student Name and Mark. From this table
we have to find out Nth Highest Mark.



SELECT TOP 1 Mark FROM (SELECT TOP {N} Mark FROM Student ORDER BY Mark DESC)
AS E ORDER BY Mark ASC



Where {N}= 2,3,4,5 etc

Eg: For 4th Highest Mark {N}=4





Responses

Author: mani kumar.k.m    25 Jul 2008Member Level: Gold   Points : 1
Hi saji,

nice example.

its query very useful to lots of guys.
Thanks for sharing your knowledge with us.

thanks & regards


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sql  .  Query  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: how to select last inserted record in sqlserver2005
Previous Resource: Creating Triggers
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use