Hello everyone! First post here, long time reader.
I have two FoxPro tables
e.g. Table1.dbf and Table2.dbf
Table1 with fields distance(numeric), time(character), type(char), address (char) Records=200
Table2 with fields distance(numeric), time(character) Records=25
If the distance in table2 matches the distance in table1, I need to update table1 time with table2 time.
Table1
Distance Time Type Address
408.31 123 1 54
408.99 1 65
410.55 1 55
412.22 444 1 66
415.55 1 78
Table2
Distance Time
408.99 555
410.55 632
415.55 688
Table1 after modification
Distance Time Type Address
408.31 123 1 54
408.99 555 1 65
410.55 632 1 55
412.22 444 1 66
415.55 688 1 78
I came up with a join tables command but only to a new table creating new columns, etc.
SELECT table1.distance, table1.time, table1.Type, table1.Address, table2.distance, table2.time
FROM TABLE1.DBF ;
LEFT OUTER JOIN TABLE2.DBF ;
ON TABLE1.distance = TABLE2.distance INTO TABLE TABLE1_MOD
*** the previous commamd will merge both tables into TABLE1_MOD, generating some records will null values so I filter not to include nulls
SET FILTER TO time <> ""
*** the following command will replace the time
replace ALL time_a WITH time_b
/////////////
I do no like the method I used, I do not know how to do it on the same table1 instead of creating a new one.
Thank you all!
Cacho
I have two FoxPro tables
e.g. Table1.dbf and Table2.dbf
Table1 with fields distance(numeric), time(character), type(char), address (char) Records=200
Table2 with fields distance(numeric), time(character) Records=25
If the distance in table2 matches the distance in table1, I need to update table1 time with table2 time.
Table1
Distance Time Type Address
408.31 123 1 54
408.99 1 65
410.55 1 55
412.22 444 1 66
415.55 1 78
Table2
Distance Time
408.99 555
410.55 632
415.55 688
Table1 after modification
Distance Time Type Address
408.31 123 1 54
408.99 555 1 65
410.55 632 1 55
412.22 444 1 66
415.55 688 1 78
I came up with a join tables command but only to a new table creating new columns, etc.
SELECT table1.distance, table1.time, table1.Type, table1.Address, table2.distance, table2.time
FROM TABLE1.DBF ;
LEFT OUTER JOIN TABLE2.DBF ;
ON TABLE1.distance = TABLE2.distance INTO TABLE TABLE1_MOD
*** the previous commamd will merge both tables into TABLE1_MOD, generating some records will null values so I filter not to include nulls
SET FILTER TO time <> ""
*** the following command will replace the time
replace ALL time_a WITH time_b
/////////////
I do no like the method I used, I do not know how to do it on the same table1 instead of creating a new one.
Thank you all!
Cacho