>
>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