Nth row of the table | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Nth row of the table

I want to select the nth record from the table without using top or any
other table. For eg. I have 20 records in a table I want to fetch the
6th record only.
How can I get that record.
lkarthik

Select t1.no From Table t1, Table T2 WHere
t1.no <= T2.no Group by t1.no Having Count(t1.no) = 6
Madhivanan Failing to plan is Planning to fail
this has been a bit frequent these days in the forum [url://www.sqlservercentral.com/columnists/dasanka/findminmaxvaluesinaset.asp[/rl]
is same as madhivans reply, but please note that this is reduce your performaces in 2005 you will find in built functions for these
http://www.sql-server-performance.com/q&a124.asp —
Frank Kalis
SQL Server MVP
http://www.insidesql.de

quote:Originally posted by dineshasanka this has been a bit frequent these days in the forum [url://www.sqlservercentral.com/columnists/dasanka/findminmaxvaluesinaset.asp[/rl]
is same as madhivans reply, but please note that this is reduce your performaces in 2005 you will find in built functions for these
Yes That will work although there are duplicate numbers
Madhivanan Failing to plan is Planning to fail
I have some records in a table.i would like to loop through the records without necessarity using a cursor,how do i perform this?
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by ziek</i><br /><br />I have some records in a table.i would like to loop through the records without necessarity using a cursor,how do i perform this?<br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br /><br />Hi ziek,<br />well we use cursor to process a recordset row by row so if u want loop row by row u need to use cursor, there is no other alternative to that[<img src=’/community/emoticons/emotion-6.gif’ alt=’:(‘ />]
quote:Originally posted by ziek I have some records in a table.i would like to loop through the records without necessarity using a cursor,how do i perform this?
You should give more information on what you are trying to do
Give sample data with expected outcome
Madhivanan Failing to plan is Planning to fail
quote:Originally posted by ziek I have some records in a table.i would like to loop through the records without necessarity using a cursor,how do i perform this?
This is a really broad and unspecific question. If you want a good answer and solution, you need to give more details about what you are trying to accomplish —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

]]>