查询中的语法错误

时间:2015-04-08 08:46:38

标签: sql vba access-vba

SELECT itemID AS broID, 
       ittCode AS broField1, 
       ittDescr AS broField2, 
       itemCode AS broField3, 
       itemDesc AS broField4, 
       Qty AS broField5  
 FROM tblItem 
       INNER JOIN tblItemType ON (tblItem.itemiitID = tblItemType.ittID AND tblItem.itemProduct = true) 
       LEFT JOIN 
           (SELECT whiitemID,
                   Sum(whiQty) AS Qty   
              FROM tblWarehouseItem AS WI
                   INNER JOIN tblWarehouse AS W ON WI.whiwrhID = W.wrhID   
             WHERE w.wrhTemp = False        
               AND W.wrhActive = True    
               AND w.wrhLock = False     
          GROUP BY whiitemID) AS WItem ON tblItem.itemID = WItem.whiitemID 
ORDER BY ittCode, itemCode

当我尝试运行它时,如果你请帮助我,我会收到语法错误 enter image description here

2 个答案:

答案 0 :(得分:1)

尝试更改

INNER JOIN tblItemType ON (tblItem.itemiitID = tblItemType.ittID AND tblItem.itemProduct = true) 

INNER JOIN tblItemType ON tblItem.itemiitID = tblItemType.ittID AND tblItem.itemProduct = true 

答案 1 :(得分:1)

谢谢我解决了改变上面一行

(tblItem INNER JOIN tblItemType ON (tblItem.itemiitID = tblItemType.ittID AND tblItem.itemProduct = true))