John wrote:
I wanna update the table COMPANY from a linked field. The following is not
accepted. Could anybody help me with what the command should be?
Thanks a lot.
UPDATE `COMPANY`
SET `COMPANY`.Region_ID =
(
SELECT `Area`.Region_ID
FROM `AREA`
WHERE `COMPANY`.Area_ID = `Area`.Area_ID
)
If you use MySQL 4.0.4 or later, you can use their multi-table UPDATE
syntax. For example:
UPDATE `COMPANY`, `AREA`
SET `COMPANY`.Region_ID = `AREA`.Region_ID
WHERE `COMPANY`.Area_ID = `AREA`.Area_ID
This is MySQL-specific, so it may not work in other RDBMS brands, but it
does in MySQL.
Regards,
Bill K.