Re: Go to specified row
From: Itzik Ben-Gan (itzik_at_REMOVETHIS.SolidQualityLearning.com)
Date: 08/27/04
- Next message: Aaron [SQL Server MVP]: "Re: Other IDE tools"
- Previous message: Tom Moreau: "Re: Disconnect a particular session"
- In reply to: Eduardo Greco: "Go to specified row"
- Next in thread: Anith Sen: "Re: Go to specified row"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 27 Aug 2004 23:45:36 +0300
Something to keep in mind when talking about row numbers (besides the fact
that some people will probably bash you for the notion of a row number in a
relational environment :-), is that you need to provide a deterministic sort
criteria (unique).
e.g., give me the 15th most recent order. Most recent is defined by
orderdate, which may have duplicates, so here you also need to specify a
tie-breaker, e.g., orderid.
So...
USE Northwind
SELECT TOP 1 *
FROM (SELECT TOP 15 *
FROM Orders
ORDER BY orderdate DESC, orderid ASC) AS D
ORDER BY orderdate, orderid
-- BG, SQL Server MVP www.SolidQualityLearning.com "Eduardo Greco" <eduardo@persocom.com.br> wrote in message news:eoG$zTHjEHA.1348@tk2msftngp13.phx.gbl... > Hi there... > I want to show a specific row in my table, say, the 15th row. But I want to > show only this row, not the previous rows. > How to do it? > Using SQL Server 2000. > Thank you. > Eduardo > >
- Next message: Aaron [SQL Server MVP]: "Re: Other IDE tools"
- Previous message: Tom Moreau: "Re: Disconnect a particular session"
- In reply to: Eduardo Greco: "Go to specified row"
- Next in thread: Anith Sen: "Re: Go to specified row"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|