Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement
Message
From
18/09/2006 11:19:03
 
 
To
18/09/2006 10:49:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01154695
Message ID:
01154719
Views:
8
>Can someone please provide a suggestion for a better way to write the following sql statement:
>
>
>SELECT oInv.cDivname AS division,dStart as Start,dEnd AS
>     end,a.contno,VAL(a.contno) AS Contract,;
>     (a.qty * (a.len_ft + a.len_in/12)) AS tlen, ;
>     IIF(PADL(a.desc,4)=='  PL' OR PADL(a.desc,4)=='  CP',0,a.dim2) AS di2,;
>     IIF(PADL(a.desc,4)=='  PL' OR PADL(a.desc,4)=='  CP',0,a.dim3) AS di3,;
>     a.desc,a.dim1,a.dim2,a.dim3,a.misjunk,a.mtype,a.usedate,a.tojob,;
>     a.qty,a.len_ft,a.len_in,a.grade,a.totalwt,a.propage,a.proline,;
>     a.cutfrom,a.porder,a.popage,a.poline,ALLTRIM(b.vendorname) + '
>     ('+ALLTRIM(a.vendor)+')' AS vendor,a.heatno,a.value ;
>FROM usedmaterial a ;
>     LEFT JOIN source b;
>         ON ALLTRIM(a.vendor)== ALLTRIM(b.id) ;
>INTO CURSOR curTemp1 WHERE !DELETED() AND BETWEEN(a.adddate,dStart,dEnd) ;
>    AND PADL(a.grade,10) IN (SELECT PADL(selections,10) FROM curSpecsMover)
>    AND ALLTRIM(shapeconv(a.desc,a.dim1,a.dim2,a.dim3,a.misjunk)) IN (SELECT
>    ALLTRIM(selections) FROM curSectionMover) AND ;
>    PADL(a.contno,10) IN (SELECT PADL(selections,10) FROM curContractMover)
>
>
>
>This one is very slow!
>
>Thanks for the help!

- remove DELETED(), SQL don't support it
- ... ' CP',0,a.dim2 this can cut some dim2
- ... ' CP',0,a.dim3 as above
- if you can, remove PADL(,10)
Previous
Reply
Map
View

Click here to load this message in the networking platform