Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why these two commands will give different results
Message
 
 
To
04/12/2006 09:40:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01174441
Message ID:
01174593
Views:
9
>>
>>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

Tamar,

Thanks a lot for chiming in. There are no NULLs in the table and AFAIK it should not matter that WHERE looks for the entire table, since they should find the exact records anyway. I put the table in the right order (BTW, using old style indexes IDX) and in the second case I do a SEEK first.

I didn't mention, though, that for some records there were originally Numerical overflow and these records have **** in a Rate field. Would it affect SUM/Select SUM?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform