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 2005 Forums
 Transact-SQL (2005)
 How to get the top Nth record ?

Author  Topic 

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2007-04-04 : 17:19:06
Hi All,

I need to know how to get the top 5th record. Here I do not mean the top 5 records, but rather the top 5th record.

Example:

Let say I have a table Employee with a field Name. The table has following 10 records

Name

Tina
Lisa
Sara
Nicole
Jenny
John
Tony
Andy
Steve
Allen

Now, how I can get the top 5th record (which in this example is Jenny) ?

Anyone has any idea?

Thanks in advance....




Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-04-04 : 17:22:41
Interview question?



CODO ERGO SUM
Go to Top of Page

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2007-04-04 : 17:24:52
Yes.
But I am curious to know.

Any idea?
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-04-04 : 17:39:29
Do a forum search. This exact same question has been answered here about a hundred times.



CODO ERGO SUM
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-05 : 01:04:45
or do google search on Find Nth Maximum value+sql server

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -