Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with TOP in SELECT - SQL
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00323019
Message ID:
00323698
Views:
17
>>>I'm probably wrong in this, but the TOP is issued after order by. So you are sorting all of them and then taking the top 21. This is 2 steps non optimized.
>>>
>>>Why not create a view without the order by, open it nodata, index on ship_no and then requery() as test 1.
>>>
>>>Test 2 create a view without the top, or order by. Same as above, but count the first 21 rows.
>>
>>Maybe I'm not quite following what you're saying, but I don't think this would work well for those really *large* tables.
>>
>>The purpose of this endeavor is to come up with method for navigating thru a dataset 20 records at a time. I select a starting point (hence the "ship_no >= m.ship_no" part) and then select 21 records (20 that are displayed and the 21st as a starting point for the next 21).
>>
>>I was shooting for a single method that would work well in both native Fox and SQL Server but maybe that's just too much to wish for, huh?{s}
>>
>>Thanks, Stephen.
>
>Dude, use the view! In a view you can tell it the volume of data to return. If you like 20, then so be it. This will work on local as well as remote views.
>
>DBSetProp('SUMVIEW', 'View', 'FetchSize', 20)
>
>__Stephen

Stephen,

How does this affect the number of records returned? Isn't FetchSize just a count of how many will be returned at one time? You'll still get all the records, eventually, right?
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform