Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating a table from another table
Message
 
 
To
12/03/2002 15:38:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00631739
Message ID:
00631887
Views:
26
This message has been marked as the solution to the initial question of the thread.
Unfortunately, you cannot use UPADTE SQL Where clause to join tables. If you have compound index on the suniq and ident fileds than you can set relation from TableA to TableB and use REPLACE command to update TableA. Something like
SET ORDER TO < compound index on the suniq and ident fileds > IN TableA 
SELECT TableB
SET RELATION TO suniq + ident INTO TableA 
REPLACE FOR FOUND("TableA") ...
Or you can use SCAN
SELECT TableA
SCAN
  UPDATE TableB SET ... ;
     WHERE TableB.suniq = TableA.suniq AND TableB.ident = TableA.ident
ENDSCAN
Remember that expression in the WHERE clause doesn't join TableB and TableA but uses values from the current records in the TableA.

>Hello group,
>
>Is it possible to update the records in table b from table a. They would be linked by suniq and ident
>
>so something like
>
>update b
>set *
>where a.suniq = b.suniq and a.ident = b.ident
>
>I am not new at this but I do it so infrequently that I don't have a good understanding of it.
>
>Thanks
>Jim
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform