Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>SELECT * FROM PRO_SCHT INTO CURSOR PROSCHT WHERE ALLTRIM(PRO_SCHT.SPFLAG)="*"
>SELECT 0000000000.000 AS CNTRANGE ,* FROM proscht a INTO DBF &pscht where EXISTS(SELECT * FROM PROD_TRAN b WHERE (a.p_number=b.p_number AND ALLTRIM(b.TRANNUMBER)=ALLTRIM(m.trannumber)))
>
I think your problem has to do with the EXISTS subquery. When you use EXISTS and reference fields from the main query in the subquery (that's called a "correlated subquery"), FoxPro has to run the subquery for each record in the main query. If you can rewrite it using IN and a subquery that's not correlated, it should speed up. And the good news is that any EXISTS subquery can be rewritten as an IN subquery.
WHERE a.p_number + ALLTRIM(a.TRANNUMBER) IN ;
(SELECT b.p_number + ALLTRIM(m.trannumber) FROM PROD_TRAN b)
Of course, you have to make sure the expression is all character and will match correctly.
Tamar
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement