Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

How we can find the nth higest number in MSSQL?

This is a discussion on How we can find the nth higest number in MSSQL? within the SQL Server forums, part of the Databases category; How we can find the nth higest number in MSSQL?...

Go Back   Geeks Talk > Databases > SQL Server
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

SQL Server SQL Server is a Database Management System(DBMS) by Microsoft

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-28-2007
Junior Member
 
Join Date: Sep 2007
Location: India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
nilesh.shinde is on a distinguished road
How we can find the nth higest number in MSSQL?

How we can find the nth higest number in MSSQL?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-31-2007
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,853
Thanks: 9
Thanked 168 Times in 142 Posts
debasisdas has a spectacular aura aboutdebasisdas has a spectacular aura about
Re: How we can find the nth higest number in MSSQL?

What do you mean by nth higest number . Are you trying to find out nth heighest value from a table . Like 10th heighest salary or 5th elder person. Please specify your requirment clearly.
Reply With Quote
  #3 (permalink)  
Old 01-28-2008
Junior Member
 
Join Date: Jan 2008
Location: Israel
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
LarryL is on a distinguished road
Re: How we can find the nth higest number in MSSQL?

To fine the N-th highest number you can use the subquery and substitute <N> with the desired number:

SELECT MIN(ColumnName) FROM TableName WHERE ColumnName IN (SELECT TOP <N> ColumnName FROM TableName ORDER BY ColumnName DESC)
Reply With Quote
  #4 (permalink)  
Old 02-25-2008
Junior Member
 
Join Date: Feb 2008
Location: Hyd
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
rsurya is on a distinguished road
Re: How we can find the nth higest number in MSSQL?

select max(coloumn-name) from Table-name

try out this it will give the n-th highest number
Reply With Quote
  #5 (permalink)  
Old 02-25-2008
Junior Member
 
Join Date: Sep 2007
Location: Hyderabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
surendra.java is on a distinguished road
Thumbs up Re: How we can find the nth higest number in MSSQL?

select * from emp e1 where n=(select count(Distinct e2.sal) from emp e2 where e1.sal<=e2.sal);


in "n" place u can give any no 0k.... it is working...

ALL THE BEST
Reply With Quote
  #6 (permalink)  
Old 02-25-2008
Junior Member
 
Join Date: Feb 2008
Location: chennai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rajilakshmi is on a distinguished road
Re: How we can find the nth higest number in MSSQL?

Hi, can any one tell me is it possible to install informatica tool in linux operating systems.
Reply With Quote
Reply

  Geeks Talk > Databases > SQL Server

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Fastest algorithm to find the number of bits set in a number? chandan1008 C and C++ 4 08-27-2008 08:31 AM
Find out the next number Innila Brainteasers 7 05-30-2007 07:57 AM
Find the next 4 number Manojks Brainteasers 8 02-22-2007 02:12 AM
Can you find the number SriramKrishna Brainteasers 4 10-25-2006 12:56 PM
Find the next number RyanJames Brainteasers 2 08-16-2006 06:46 AM


All times are GMT -4. The time now is 06:19 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved