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 14:28:23
Mike Yearwood
Toronto, Ontario, Canada
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:
01174710
Views:
10
>Naomi
>
>There is no need to set order before a SQL-Select. In fact, SQL-Select reopens the cursors and does things it's own way. You're not helping it at all. In fact, doing the set order is wasting time.
>
>The xBase SUM WHILE line is not an exact replacement for the SQL-Select line.
>

What is the exact difference between two?

I do need to set order for SQL-Select using OLD style indexes (IDX). That was discussed recently on UT and Hugo R helped me to understand that. For these tables we're using old style IDX indexes.



>>
>>SELECT Comision
>>				lnRecno = RECNO()
>>                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
>>                lcRate = EVL(laArr[1],0)		
>>                IF SEEK(m.ccinv + m.Slsman)                	
>>					SUM (rate*SHARE/10000) TO cRate WHILE inv_no+salesman = m.ccinv + m.Slsman
>>				ELSE
>>					cRate = 0
>>				endif		
>>                	
>>                	IF NOT m.cRate == m.lcRate
>>                		=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(m.lcRate)
>>                	ENDIF
>>
>>The two reported mismtach cases are wrong, since in first case the invoice is for different person and in second it doesn't exist. I just re-indexed the table on inv_no + salesman and the problem persists.
>>
>>Do you know, what I'm doing wrong?
>>
>>Thanks again.
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