0
SELECT 
    [Stock Conversion Items].SCID, 
    [Stock Conversion Items].[Result PC], 
    [Stock Conversion Items].[Quantity], 
    [Stock Conversion].[Date], 
    [products/stock].[Description] 
FROM 
    [Stock Conversion Items] 
INNER JOIN [Stock Conversion] 
    ON [Stock Conversion Items].SCID = [Stock Conversion].SCID 
INNER JOIN [products/stock] 
    ON [Stock Conversion Items].[Result PC] = [products/stock].[Product Code] 
ORDER BY [Stock Conversion Items].SCID;

这段代码很容易解释,基本上我得到一个我根本无法解决的语法运算符错误。

4

3 回答 3

3

对查询进行了一些重新调整,并使其看起来像这样:

SELECT sci.SCID, sci.[Result PC], sci.Quantity, sci.Date, s.Description
FROM [Stock Conversion Items] sci
INNER JOIN [Stock Conversion] sc 
   ON sci.SCID = sc.SCID 
INNER JOIN [products/stock] s 
   ON sci.[Result PC] = s.[Product Code] 
ORDER BY sci.SCID;

该语句中唯一可能失败的是on子句。您确定两个 SCID 列以及 [Result PC] 和 [Product Code] 列属于同一类型吗?

于 2012-10-05T13:51:27.040 回答
0

出于某种原因,Access 似乎想在第一个连接周围加上括号。这似乎有效:

SELECT [Stock Conversion Items].SCID, [Stock Conversion Items].[Result PC], [Stock Conversion Items].Quantity, [Stock Conversion].Date, [products/stock].Description
FROM ([Stock Conversion] INNER JOIN [Stock Conversion Items] ON [Stock Conversion].SCID = [Stock Conversion Items].SCID) INNER JOIN [products/stock] ON [Stock Conversion Items].[Result PC] = [products/stock].[Product Code];
于 2012-10-05T13:57:59.080 回答
0
        SELECT [Stock Conversion Items].SCID,
     [Stock Conversion Items].[Result PC],
     [Stock Conversion Items].Quantity,
     [products/stock].Description,
     [Stock Conversion].[SC Date],
     [Stock Conversion].[Created By]

     FROM [Stock Conversion Items]
      INNER JOIN ([products/stock] INNER JOIN [Stock Conversion]
        ON [products/stock].[Product Code] = [Stock Conversion].[Source PC])
        ON [Stock Conversion Items].SCID = [Stock Conversion].SCID;

所以这就是 Access 为解决我的问题而提出的方法,设法让事情正常工作,认为这可能是数据类型不匹配。所以感谢斯韦科。

于 2012-10-05T14:17:24.247 回答