Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update single column from another table
Message
From
28/11/2001 17:44:37
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00587103
Message ID:
00587239
Views:
31
I'll do this from scratch. Hope this isn't too basic, just wanted to avoid ambiguity. As I'm sure you know, always hit the Enter key after each command in the command window to tell VFP to execute it.

1. Open up both tables in the Data Session interface (from the menu option Window..Data Session)

2. Create an index on T1.
*   Select T1 as the current work area (press the mouse button on the line indicating T1).
*   Type the following command in the command window:

INDEX ON emp_name + DTOC (rptdate) TAG PK

*   Order the table on the basis of that index in the command window:

SET ORDER TO PK
3. Set a relationship between the two tables.
*   In the command window, type:

SELECT T2
SET RELATION TO emp_name + DTOC (rptdate) INTO T1
4. Perform the replacement.
*   In the command window, type: 

REPLACE ALL T2.commission with T1.commission
That should address your update issue. The tables are still related, so before doing other operations, you may want to select T2 in the Data Session interface, and then type SET RELATION TO in the command window to disconnect them.

That should work for you. Best wishes!

Jay




>Hi Jay,
>Sorry but I'm not at all familiar with xBase commands
>or what it is for that matter. Could you possibly describe
>to me what steps to take?
>Thanks
>Max
>
>>>I'm a victim of false memories! Sergey was right -- no join between 2 tables >>is possible with UPDATE.
>
>>>I'd suggest using good ol' xBase commands.
>
>>>Set the relation between T1 and T2 based on an index of the PK values (name >>and date). Then do a REPLACE ALL t2.commission WITH t1.commission.
>
>>>Best wishes, and sorry for the bad lead.
>
>>>Jay
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform