Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why these two commands will give different results
Message
 
 
À
04/12/2006 09:40:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01174441
Message ID:
01174629
Vues:
10
>>
>>SELECT SUM(rate*SHARE/10000) AS crate WHERE inv_no+salesman = m.ccinv + m.Slsman ;
>>	                FROM comision INTO ARRAY laArr
>>
>>SUM (rate*SHARE/10000) TO cRate WHILE inv_no+salesman = m.ccinv + m.Slsman
>>
>>
>
>Aside from the string matching, there are two potential issues here:
>
>1) WHERE looks at the entire table; WHILE starts at the current record and stops as soon as there's a mismatch.
>
>2) SELECT SUM() ignores Nulls. SUM does not.
>
>Tamar

Without seek before select SUM I got the following results
Found a mismatch on I801972COL cRate = 0 laArr[1]= 0.100000000
Found a mismatch on I518767COL cRate = 0 laArr[1]= 0.100000000

The first invoice has a different person as a salesman, and the second doesn't exist in Comision at all (I just tried in Command window to search for these invoices).

The array is defined as local at the top of the procedure.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform