Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL update field from another table
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01162808
Message ID:
01162832
Views:
16
>I have a cust.dbf and an orders.dbf. The key of cust.dbf is custkey. The key of orders.dbf is custkey, orderseq. There is region field that is on both tables (I know, bad design), that has gotten out of sync between the customer and order tables. I want to find and replace the orders.region with the cust.region where cust.custkey = orders.custkey and cust.region != orders.region.
UPDATE orders SET region = cust.region;
FROM orders;
INNER JOIN cust ON  cust.custkey = orders.custkey and cust.region != orders.region
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform