我想更新另一个表值的值,这是我的代码
UPDATE
ag_personal_information
SET
ag_personal_information.ag_zone_id =
(SELECT ag_officer_service_information.ag_zone_id
FROM ag_officer_service_information)
WHERE
ag_officer_service_information.ag_zone_id <> ag_personal_information.ag_zone_id
答案 0 :(得分:1)
试试这个
UPDATE ag_personal_information AS A
SET ag_personal_information.ag_zone_id = (
SELECT ag_officer_service_information.ag_zone_id
FROM ag_officer_service_information AS B
WHERE A.ag_officer_service_information.ag_zone_id <> B.ag_personal_information.ag_zone_id)
答案 1 :(得分:0)
将=
放在ag_officer_service_information.ag_zone_id
和ag_personal_information.ag_zone_id
UPDATE ag_personal_information
SET ag_personal_information.ag_zone_id =
(SELECT ag_officer_service_information.ag_zone_id FROM ag_officer_service_information)
WHERE ag_officer_service_information.ag_zone_id = ag_personal_information.ag_zone_id