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
 Transact-SQL (2000)
 Nth Position...

Author  Topic 

collegeguy
Starting Member

4 Posts

Posted - 2002-01-16 : 05:25:43

declare @nthpos int
set @nthpos = 3
select empname,sal from employee a
where @nthpos = (
select count(distinct(sal)) from employee b where a.sal <= b.sal)
This will return the nth position in a table.
If you wish to use this using the TOP Predicate, how will you do it?

Cllege Guy

Nazim
A custom title

1408 Posts

Posted - 2002-01-16 : 07:36:59
Read these Article's by Graz
http://www.sqlteam.com/item.asp?ItemID=566
http://www.sqlteam.com/item.asp?ItemID=233


----------------------------------
"True love stories don't have endings."

Edited by - Nazim on 01/16/2002 08:40:13
Go to Top of Page
   

- Advertisement -