Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to select x number of rows
Message
From
12/08/2010 19:10:37
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01476406
Message ID:
01476407
Views:
70
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform