Hi!
Using an example from here and a wonderful e-book I just downloaded, Taming VFP SQL, I have written this SELECT:
It works great until I try to add the WHERE. Then no matter how I have tried to write it I get an error. Either missing ')' or syntax error, depending on the way I am trying it.
Would someone please show me how to write that line?
scpdate is a field in one table
date fields are caught from the user selection on form.
Many thanks for any help.
Judi
Using an example from here and a wonderful e-book I just downloaded, Taming VFP SQL, I have written this SELECT:
Code:
SELECT scpjobs,scpdate, orders.jobsnumb, orders.ordrnumb, ;
orders.partnumb,orders.custno, ;
SUM(IIF(VAL(SCPTYPE)=1,SCPAMNT,0000)) AS type1 , ;
SUM(IIF(VAL(SCPTYPE)=2,SCPAMNT,0000)) AS type2 , ;
SUM(IIF(VAL(SCPTYPE)=3,SCPAMNT,0000)) AS type3 , ;
SUM(IIF(VAL(SCPTYPE)=4,SCPAMNT,0000)) AS type4 , ;
SUM(IIF(VAL(SCPTYPE)=5,SCPAMNT,0000)) AS type5 , ;
SUM(IIF(VAL(SCPTYPE)=6,SCPAMNT,0000)) AS type6 , ;
SUM(IIF(VAL(SCPTYPE)=7,SCPAMNT,0000)) AS type7 , ;
SUM(IIF(VAL(SCPTYPE)=8,SCPAMNT,0000)) AS type8 , ;
SUM(IIF(VAL(SCPTYPE)=9,SCPAMNT,0000)) AS type9 , ;
SUM(IIF(VAL(SCPTYPE)=10,SCPAMNT,0000)) AS type10 , ;
SUM(IIF(VAL(SCPTYPE)=11,SCPAMNT,0000)) AS type11 , ;
SUM(IIF(VAL(SCPTYPE)=12,SCPAMNT,0000)) AS type12 , ;
SUM(IIF(VAL(SCPTYPE)=13,SCPAMNT,0000)) AS type13 , ;
SUM(IIF(VAL(SCPTYPE)=14,SCPAMNT,0000)) AS type14 , ;
SUM(IIF(VAL(SCPTYPE)=15,SCPAMNT,0000)) AS type15 , ;
SUM(IIF(VAL(SCPTYPE)=16,SCPAMNT,0000)) AS type16 , ;
SUM(IIF(VAL(SCPTYPE)=17,SCPAMNT,0000)) AS type17 , ;
SUM(IIF(VAL(SCPTYPE)=18,SCPAMNT,0000)) AS type18 , ;
SUM(IIF(VAL(SCPTYPE)=19,SCPAMNT,0000)) AS type19 , ;
SUM(IIF(VAL(SCPTYPE)=20,SCPAMNT,0000)) AS type20 , ;
SUM(IIF(VAL(SCPTYPE)=21,SCPAMNT,0000)) AS type21 , ;
SUM(IIF(VAL(SCPTYPE)=22,SCPAMNT,0000)) AS type22 , ;
SUM(IIF(VAL(SCPTYPE)=23,SCPAMNT,0000)) AS type23 , ;
SUM(IIF(VAL(SCPTYPE)=24,SCPAMNT,0000)) AS type24 , ;
SUM(IIF(VAL(SCPTYPE)=25,SCPAMNT,0000)) AS type25 , ;
SUM(IIF(VAL(SCPTYPE)=26,SCPAMNT,0000)) AS type26 , ;
SUM(IIF(VAL(SCPTYPE)=27,SCPAMNT,0000)) AS type27 , ;
SUM(IIF(VAL(SCPTYPE)=28,SCPAMNT,0000)) AS type28 , ;
SUM(IIF(VAL(SCPTYPE)=29,SCPAMNT,0000)) AS type29 , ;
SUM(IIF(VAL(SCPTYPE)=30,SCPAMNT,0000)) AS type30 ;
FROM scrap ;
JOIN orders ;
ON orders.ordrnumb=scrap.scpords AND orders.jobsnumb = scrap.scpjobs ;
*!* WHERE scpdate BETWEEN **ldBegDate** **ldEndDate** ;
GROUP BY 1 ;
ORDER BY 1 ;
INTO CURSOR csrProdScrap
It works great until I try to add the WHERE. Then no matter how I have tried to write it I get an error. Either missing ')' or syntax error, depending on the way I am trying it.
Would someone please show me how to write that line?
scpdate is a field in one table
date fields are caught from the user selection on form.
Many thanks for any help.
Judi