Thumper2004
Technical User
So I am a software technical support rep for my company, and I do data analysis and data cleanup when needed. I am having some issues with a SQL/FOX program. Using FoxPro 9.
I keep getting the table1 datefield1 populating with the first record's t2.datefild3 for every record in table1. The entire program is below: Any help on what I am doing wrong to have the datefield populate incorrectly would be a great help!
Code:
UPDATE table1;
SET datefield1 =;
ICASE(;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield1 = ctod("") and t2.datefield2 =
ctod("") and t2.datefield3 = ctod("") and t3.datefield1 = CTOD(""), t3.datefield2,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield1 = ctod("") and t2.datefield2 =
ctod("") and t2.datefield3 = ctod(""), t3.datefield1,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield3 = ctod("") AND t2.datefield1 =
ctod(""), t2.datefield2,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield3 = ctod("") AND t2.datefield2 =
ctod(""), t2.datefield1,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield3 <> ctod(""), t2.datefield3,;
t1.datefield1;
);
from table1 t1;
join table2 t2 on t1.key=t2.key;
join table3 t3 on t3.key=t2.key;
where t1.datefield2 BETWEEN CTOD("01/01/1900") and CTOD("04/23/2018") and t1.datefield1 = ctod("")
I keep getting the table1 datefield1 populating with the first record's t2.datefild3 for every record in table1. The entire program is below: Any help on what I am doing wrong to have the datefield populate incorrectly would be a great help!
Code:
cd?
UPDATE table1;
SET datefield1 = CTOD("03/15/2017");
where datefield1 = CTOD("03/15/0314")
CLOSE ALL
SELECT * FROM table1.dbf
COPY TO table1_cleanup.dbf
CLOSE ALL
use table1
replace field_flag with "A" for datefield2 > ctod("04/23/2018") and
datefield2 = ctod("") and not deleted()
close all
UPDATE table1;
SET datefield1 =;
ICASE(;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield1 = ctod("") and t2.datefield2 =
ctod("") and t2.datefield3 = ctod("") and t3.datefield1 = CTOD(""), t3.datefield2,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield1 = ctod("") and t2.datefield2 =
ctod("") and t2.datefield3 = ctod(""), t3.datefield1,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield3 = ctod("") AND t2.datefield1 =
ctod(""), t2.datefield2,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield3 = ctod("") AND t2.datefield2 =
ctod(""), t2.datefield1,;
t1.datefield2 < CTOD("04/23/2018") AND t1.datefield2 > CTOD("01/01/1900") AND t2.datefield3 <> ctod(""), t2.datefield3,;
t1.datefield1;
);
from table1 t1;
join table2 t2 on t1.key=t2.key;
join table3 t3 on t3.key=t2.key;
where t1.datefield2 BETWEEN CTOD("01/01/1900") and CTOD("04/23/2018") and t1.datefield1 = ctod("")
CLOSE ALL
use table1
replace datefield1 with ctod(""), field_flag with " " for field_flag="A" and not deleted()
CLOSE ALL
QUIT