Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 find the nth (3rd or 4th)largest row in a coloumn

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-28 : 08:46:02
rohit writes "How can I find the 2nd larget or 3rd largest or nth largest
row in a coloumn.

Eg. If I have a table report with two coloumns name and scores.
How can i write an sql that can give me nth largest score among
the table.

Thanks

Rohit"

Nazim
A custom title

1408 Posts

Posted - 2002-01-28 : 08:52:25
Read this Article by Graz
http://www.sqlteam.com/item.asp?ItemID=566

HTH

--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page

Richard101
Starting Member

30 Posts

Posted - 2002-02-16 : 17:05:04
Try this to return the fifth (change '5' to n for another position)

use northwind
go
drop table #temp
select top 5 Freight
into #temp
from orders
order by Freight desc
select top 1 * from #temp order by freight

Go to Top of Page
   

- Advertisement -