Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query Nth Row
Message
From
06/09/2005 07:51:00
 
 
To
02/09/2005 15:35:26
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Miscellaneous
Thread ID:
01046354
Message ID:
01046948
Views:
19
>>For a given order of rows in a SQL Server table ( I.e. the natural order or the order an ORDER BY clause would generate ), is it possible to efficiently query the Nth row in the table?
>>
>>Thanks,
>>Bill
>
>Incomplete and Not extremely efficient:
>
>SELECT TOP 1 * FROM
> (SELECT TOP N * FROM TABLE1 ORDER BY clause) X ORDER BY clause DESC
>
Hi Fabio,

Thanks. Yes, I came up with something similar to this. Will work ok for smaller tables but as you mentioned, becomes expensive for larger tables. That's why I added the "efficient" qualifier. :-) But there doesn't seem to be a simple solution to this without using an auxiliary work table.

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Reply
Map
View

Click here to load this message in the networking platform