我现在已经发现这个特殊错误几个小时了,我仍然无法弄清楚我的生活中我的选择陈述有什么问题,我试图连接3个表。
"SELECT POItem.PO AS 'Purchase_Order', POItem.Qty AS 'Quantity',
POItem.BCurr as 'Currency', POItem.TotalCost, PO.Vendor, Master.Desc1
FROM PO
LEFT JOIN POItem ON PO.ID = POItem.PO AND
INNER JOIN Master ON Master.IPN = POItem.IPN
WHERE POItem.IPN = '" & TextBox1.Text & "'
ORDER BY POItem.PO DESC"
答案 0 :(得分:3)
此位置不需要examples/cherry
个关键字(位于AND
前面)。如果您将其删除并在INNER JOIN
周围添加括号,则您的查询应该有效:
LEFT JOIN
顺便说一下,不要在字符串中包含"SELECT POItem.PO AS 'Purchase_Order', POItem.Qty AS 'Quantity',
POItem.BCurr as 'Currency', POItem.TotalCost, PO.Vendor, Master.Desc1
FROM (PO
LEFT JOIN POItem ON PO.ID = POItem.PO)
INNER JOIN Master ON Master.IPN = POItem.IPN
WHERE POItem.IPN = '" & TextBox1.Text & "'
ORDER BY POItem.PO DESC"
的值,而是使用Parameters以避免SQL注入攻击。