Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replacing one field with certain records in two tables
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Replacing one field with certain records in two tables
Miscellaneous
Thread ID:
00634995
Message ID:
00634995
Views:
54
Good day,
I have a table (table1) with with duplicate names of employees but each record is defined differently through the date field. I have another table (table2) with distinct employees and I am trying to replace the one field where the dates and names are the same in table1 and table2. However when I use the "Set Relation To" it replaces all the entire field even if the dates are not the same between the two tables. Where the date is the same it replaces the correct information but where the date is different it replaces it with "0" overwriting the correct information that was originally there. Here's the code I use:

select table2 && Table to take field from
INDEX ON emp_number + dtoc(datework) TAG PK
SET ORDER TO PK
select table1 && Table to replace field
SET RELATION TO emp_number + dtoc(datework) INTO table2
REPLACE ALL table1.field with table2.field

Can anyone please help!
Thank you!
Max
Next
Reply
Map
View

Click here to load this message in the networking platform