0

首先,我查看了类似的问题,但没有找到适合我的情况的问题。我转成sql的访问代码如下(不是我写的)

UPDATE QUpdateTrialstepApproved1 
INNER JOIN TrialStepApproved ON 
QUpdateTrialstepApproved1.cid_req = TrialStepApproved.cID 
SET TrialStepApproved.wm21 = [wm2_req], 
TrialStepApproved.sw = [startweek_req], 
TrialStepApproved.PlannedTotalm2 = [m2_req], 
TrialStepApproved.ew = [endweek_req], 
TrialStepApproved.ActualNrofDiffEntries = [entries_req],
TrialStepApproved.entryfactorTrial1 = [eFtrial_req],
TrialStepApproved.fixeddeliveryweek = [fixedEndweek_req],
TrialStepApproved.culturename = [culturename_req] 
WHERE (((QUpdateTrialstepApproved1.approveRequestChange)="v") 
AND ((TrialStepApproved.Location) Is Not Null));

我已将其变成以下内容,但标题中出现错误:

UPDATE A  
SET B.wm21 = [wm2_req], 
B.sw = [startweek_req], 
B.PlannedTotalm2 = [m2_req], 
B.ew = [endweek_req], 
B.ActualNrofDiffEntries = [entries_req], 
B.entryfactorTrial1 = [eFtrial_req], 
B.fixeddeliveryweek = [fixedEndweek_req], 
B.culturename = [culturename_req]
from QUpdateTrialstepApproved1 as A 
INNER JOIN TrialStepApproved as B ON A.cid_req = B.cID 
WHERE A.approveRequestChange='v' AND B.Location Is Not Null
4

1 回答 1

2

你在更新B,不是A。将第一行更改为

UPDATE B

......一切都会好起来的。

一个 SQLfiddle

于 2013-07-30T20:40:48.700 回答