Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed in results
Message
 
 
To
12/08/2008 13:01:31
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01338372
Message ID:
01338373
Views:
16
I like the Select-SQL solution, I think it should be the fastest. I slightly adjusted the solution #1. Don't use number 3 with ORDER. The table should not have any order set for SCAN FOR.

>Hi, what do you think on which of the following samples below would produce faster result? Or there's no difference at all?
>
>Total number of records in table is 500,000
>There are 10 records whose cv_no is = "00800".
>record numbers for the ten (10) cv_no="00800" is from recno(440,000 to 449,000 )
>
>lcDocNumb="00800"
>
>
>
>Sample No. 1
>
>Select CVdtl
>set order to CVnoacct
>IF Seek(lcDocNumb)
>   scan while CV_no=lcDocNumb 
          IF not DELETED()
>                lnSLDBAmt  = lnSLDBAmt + SLDebit
>                lnSLCRAmt  = lnSLCRAmt + SLCredit
>                lnGLDBAmt  = lnGLDBAmt + GLDebit
>               lnGLCRAmt  = lnGLCRAmt + GLCredit
>         Endif
>    enddo
>ENDIF
>
>
>Sample No. 2
>
>SELECT SUM(A.SLDebit) as lnSLDBAmt, SUM(SLCredit) as lnSLCRAmt, ;
SUM(GLCredit) as lnGLCRAmt, SUM(GLDebit) as lnGLDBAmt;
>FROM CVdtl A WHERE A.CV_no=lcDocNumb .and. .not. DELETED() INTO CURSOR Temp1 GROUP BY A.CV_no
OR
SET DELETED ON
SELECT SUM(SLDebit) as lnSLDBAmt, SUM(SLCredit) as lnSLCRAmt, ;
SUM(GLCredit) as lnGLCRAmt, SUM(GLDebit) as lnGLDBAmt, Cv_No ;
>FROM CVdtl WHERE CV_no=lcDocNumb GROUP BY Cv_NO into cursor curTemp
>
>
>Sample No. 3
>
>Select CVdtl
>*set order to CVnoacct - comment this out
>SCAN FOR CV_no=lcDocNumb
>        IF .not. DELETED()
>            lnSLDBAmt  = lnSLDBAmt + SLDebit
>            lnSLCRAmt  = lnSLCRAmt + SLCredit
>            lnGLDBAmt  = lnGLDBAmt + GLDebit
>            lnGLCRAmt  = lnGLCRAmt + GLCredit
>      Endif
>ENDSCAN
>
>
>
>Thanks
>
>Sonny
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