Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to select x number of rows
Message
De
12/08/2010 19:10:37
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01476406
Message ID:
01476407
Vues:
71
>Hi,
>
>Is there SQL Select that can be used to select X number of records without using TOP (I find TOP is too slow). The SQL Select will have a WHERE expression but I want to return only certain number of records even if WHERE finds more.

TOP seems like the tool for that job. It requires ORDER BY, but if you have an index on that expression it should be fast. If the result set before being reduced to X is relatively small, getting TOP X should be fast even without an index.

If you're getting too many rows returned before TOP is applied, maybe you need to be more specific in your WHERE clause(s).
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform