Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Quick retrieval
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00327540
Message ID:
00328297
Views:
31
Ed,

Your suggestion below does not work because in ...ORDER BY Paye, Paye is not a field, but an index tag... and Paye does not subsitute itself by the index expression in the SQL.

USE Facture IN 0
SELECT * FROM Facture INTO TABLE Tmp ORDER BY Paye
USE IN Facture
BROWSE

And no, Facture is not small at all. And it is growing every day and fast too since this client will likely triple his sales volume within the next year. So, the second suggestion is not an option.

So far, I tried some other ways and so far my first solution is still the fastest way of retrieval... which is quite fast after all. Just though there was a more optimised way to get the data and a more "elegant" way of coding.

Have a nice day.

Réal
==============================
>>Here is the problem: I cannot make the SQL perform as fast as the Browse (I can really feel that the optimisation is not working) even if I copy the index key as is in the Where clause of the SQL.
>>
>>Here is the code I used but... is there a better way?
>>
>>USE FACTURE ORDER PAYE IN 0
>>SELECT FACTURE
>>=AFIELDS(TABL)
>>CREATE CURSOR TMP FROM ARRAY TABL
>>RELEASE TABL
>>SELECT FACTURE
>>SCAN
>>   SCATTER MEMVAR
>>   INSERT INTO TMP FROM MEMVAR
>>ENDSCAN
>>USE IN FACTURE
>>SELECT TMP
>>BROWSE
>>
>
>Well, at the cost of having to clean up your mess later by erasing the file:
>
>USE Facture IN 0
>SELECT * FROM Facture INTO TABLE Tmp ORDER BY Paye
>USE IN Facture
>BROWSE
>
>If Facture is small enough:
>
>USE FACTURE IN 0
>=AFIELDS(aFlds,'Facture')
>CREATE CURSOR TMP FROM ARRAY aFlds
>RELEASE aFlds
>SELECT * FROM Facture INTO ARRAY aValSet ORDER BY Paye
>SELECT TMP
>APPEND FROM ARRAY aValSet
>RELEASE aValSet
>USE IN Facture
Réal Philippon
www.ultra.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform