0

我想从另一个表值更新一个值,这是我的代码

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
4

2 回答 2

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) 
于 2013-07-19T07:06:17.550 回答
0

放在和=之间ag_officer_service_information.ag_zone_idag_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
于 2013-07-19T07:13:20.040 回答