S
Sammo
Unregistered / Unconfirmed
GUEST, unregistred user!
[?]有两个ACCESS表,Goods和Supply
Goods表有字段:ID,Name,Store,StoreTun,Remarks
Supply表有字段:ID,Name,TheDate,Buy,Supply,GetTun,Remarks
使用如下的SQL语句:
UPDATE Goods SET Store = gg.Store + sum1,StoreTun=gg.StoreTun+sum2
FROM Goods AS gg,
(SELECT ID,Name,SUM(Buy)-SUM(Supply) AS sum1,SUM(Supply)-SUM(GetTun) AS sum2
FROM Supply group by ID,Name) AS ss
WHERE (ss.ID=gg.ID AND ss.Name=gg.Name)
出错信息如下:
syntax error (missing operator) in query expression 'gg.StoreTun+sum2 FROM Goods AS gg'.
Goods表有字段:ID,Name,Store,StoreTun,Remarks
Supply表有字段:ID,Name,TheDate,Buy,Supply,GetTun,Remarks
使用如下的SQL语句:
UPDATE Goods SET Store = gg.Store + sum1,StoreTun=gg.StoreTun+sum2
FROM Goods AS gg,
(SELECT ID,Name,SUM(Buy)-SUM(Supply) AS sum1,SUM(Supply)-SUM(GetTun) AS sum2
FROM Supply group by ID,Name) AS ss
WHERE (ss.ID=gg.ID AND ss.Name=gg.Name)
出错信息如下:
syntax error (missing operator) in query expression 'gg.StoreTun+sum2 FROM Goods AS gg'.