>>>I haven't figured why I was getting different results, but I decided to move on.
>>
>>Check COUNT(*) vs COUNT, are they equals.
>
>I can not reproduce this problem now.
>
> SET ORDER TO com_inv IN comision
> IF SEEK(m.ccinv + m.Slsman)
>
> *SUM (rate*SHARE/10000) TO cRate WHILE inv_no+salesman = m.ccinv + m.Slsman
> SELECT SUM(rate*SHARE/10000) AS crate WHERE inv_no+salesman = m.ccinv + m.Slsman ;
> FROM comision INTO ARRAY laArr
>*!* IF NOT m.cRate == laArr[1]
>*!* =MESSAGEBOX("Found a mismatch on " + m.ccinv + m.Slsman)
>*!* _cliptext = _cliptext + "Found a mismatch on " + m.ccinv + m.Slsman + " cRate = " + ;
>*!* TRANSFORM(m.cRate) + " laArr[1]= " + TRANSFORM(laArr[1])
>*!* ENDIF
> cRate = laArr[1]
> ELSE
> cRate = 0
> endif
>
>With SEEK before select both return the exact same amount.
However, if I comment SEEK before SELECT like this
SET ORDER TO com_inv IN comision
SELECT SUM(rate*SHARE/10000) AS crate WHERE inv_no+salesman = m.ccinv + m.Slsman ;
FROM comision INTO ARRAY laArr
cRate = EVL(laArr[1],0)
I get a different result. Why would SEEK make such difference?
If it's not broken, fix it until it is.
My Blog