2016-08-18 118 views
0

我有以下SQL語句:SQL的MS Access 2013

UPDATE tbl_Invoices 
SET tbl_Invoices.Base = tbl_Bases.BasePrice 
FROM tbl_Invoices 
INNER JOIN tbl_Bases ON tbl_Bases.ProductNumber = tbl_Invoices.ProductNumber 
        AND tbl_Bases.ChangeOrderID = tbl_Invoices.ChangeOrderID 
        AND tbl_Bases.CustomerName = 'VALEO' 
        AND tbl_Bases.CountryCode = 'FR' 
        AND tbl_Bases.ContractYear = 0 

訪問一直告訴我,我有一個語法錯誤(缺少操作員)

這驅使我堅果。有人能告訴我什麼是錯的嗎?

+0

您可以發佈確切的錯誤信息?還有表格的DDL/DML腳本?該查詢看起來一見鍾情。 – NickyvV

回答

0

非常感謝。 我仍然有一個錯誤的=「VALEO」等等都不允許加入,但是這是工作,如果移動到WHERE子句:

UPDATE tbl_Invoices 
INNER JOIN tbl_Bases ON tbl_Bases.ProductNumber = tbl_Invoices.ProductNumber 
        AND tbl_Bases.ChangeOrderID = tbl_Invoices.ChangeOrderID 
SET tbl_Invoices.Base = tbl_Bases.BasePrice 
WHERE tbl_Bases.CustomerName = 'VALEO' 
        AND tbl_Bases.CountryCode = 'FR' 
        AND tbl_Bases.ContractYear = 0 
0

UPDATE ... FROM不訪問SQL存在,在這裏你做這樣的:

UPDATE tbl_Invoices 
INNER JOIN tbl_Bases ON tbl_Bases.ProductNumber = tbl_Invoices.ProductNumber 
        AND tbl_Bases.ChangeOrderID = tbl_Invoices.ChangeOrderID 
        AND tbl_Bases.CustomerName = 'VALEO' 
        AND tbl_Bases.CountryCode = 'FR' 
        AND tbl_Bases.ContractYear = 0 
SET tbl_Invoices.Base = tbl_Bases.BasePrice