Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update one table based on another table
Message
From
30/03/2005 14:32:29
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00999981
Message ID:
01000044
Views:
17
>Hi everybody,
>
>Is it possible to update one table based on another?
>
>Here is my attempt:
>
>UPDATE trans SET cCommissioned_Owner = curt.cOwner WHERE trans.ctrans_pk = Curt.ctrans_pk
>
>In curt I put two records, but only one record was updated in Trans. Is it possible to do or it would be better to scan curt and update one record in a time (or use replace command - which is better?)
>
>Thanks a lot in advance.

If some conditions are valid:
UPDATE TRANS SET cCommissioned_Owner = LOOKUP(Curt.cOwner,ctrans_pk,Curt.ctrans_pk)
* or + restricted
REPLACE IN TRANS ALL FOR ctrans_pk=LOOKUP(Curt.ctrans_pk,ctrans_pk,Curt.ctrans_pk) ;
cCommissioned_Owner WITH Curt.cOwner
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform