Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query Nth Row
Message
De
06/09/2005 07:51:00
 
 
À
02/09/2005 15:35:26
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Divers
Thread ID:
01046354
Message ID:
01046948
Vues:
18
>>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform