很高兴找到天才成员这样一个有用的网站.我一直试图找到这个SQLITE问题的解决方案.谷歌没有帮助我,除了找到这个网站.SQL查询在同一数据库的MSAccess版本上正常工作.
这是我的SQL语句 - 这对我不起作用.
SELECT Invoices.InvoiceNumber, Invoices.Quantity,Invoices.Code, Invoices.Price,Invoices.Discount, Invoices.InvoiceGrandTotal, Employees.EmployeeName, Customers.CustomerName, Invoices.DateOfInvoice, [price]*[Quantity] AS Total, Customers.Address, Products.Description,Products.Unit FROM Products INNER JOIN ( ( ( Invoices INNER JOIN InvoiceDetails ON Invoices.InvoiceNumber = InvoiceDetails.InvoiceNumber ) INNER JOIN Customers ON Invoices.CustomerID = Customers.CustomerID ) INNER JOIN Employees ON Invoices.UserID = Employees.EmployeeID ) ON Products.Code = InvoiceDetails.Code WHERE (((InvoiceDetails.InvoiceNumber)='10111'));
错误消息是: " Cannot compile Select-Statement: no such column: Invoices.InvoiceNumber
"
这通常只是意味着您错误拼写了列名...检查您的发票表并确保该列是InvoiceNumber而不是"Invoice_Number"或类似的东西......
此外,这个查询的一个更简单的版本看起来像这样..没有所有奇怪的嵌套:
SELECT Invoices.InvoiceNumber, Invoices.Quantity, Invoices.Code, Invoices.Price, Invoices.Discount, Invoices.InvoiceGrandTotal, Employees.EmployeeName, Customers.CustomerName, Invoices.DateOfInvoice, [price]*[Quantity] AS Total, Customers.Address, Products.Description, Products.Unit FROM Invoices JOIN Employees ON Employees.EmployeeID = Invoices.UserID JOIN Customers ON Customers.CustomerID = Invoices.CustomerID JOIN InvoiceDetails ON InvoiceDetails.InvoiceNumber = Invoices.InvoiceNumber JOIN Products ON Products.Code = InvoiceDetails.Code WHERE InvoiceDetails.InvoiceNumber = '10111'