ms访问时查询过于复杂错误?

时间:2014-02-04 09:12:23

标签: sql ms-access

我尝试使用此代码将3个查询绑定到单个查询中,但是当我单击“数据表视图”时,它显示错误“QUERY IS TOO COMPLEX”。

这是我的代码

SELECT 
    RPT_Invoice_Less.InvoiceNumber, 
    RPT_Invoice_Less.Terms, 
    RPT_Invoice_Less.Invoicedate, 
    RPT_Invoice_Less.OurQuote, 
    RPT_Invoice_Less.SalesPerson, 
    RPT_Customer.CustomerName, 
    RPT_Customer.CustomerId, 
    RPT_Customer.ContactPerson, 
    RPT_Customer.BillingAddress, 
    RPT_Customer.DeliveryAddress, 
    RPT_Invoice_Less.OrderNumber, 
    RPT_Invoice_Less.ShippingBy, 
    RPT_Invoice_Less.ShipReferenceNo, 
    RPT_Invoice_Less.Notes, 
    RPT_Invoice_Less.Price, 
    RPT_Invoice_Less.Discount, 
    RPT_Invoice_Less.Shipping, 
    RPT_Invoice_Less.Tax, 
    RPT_Invoice_Less.GrandTotal, 
    RPT_Company.CompanyName, 
    RPT_Company.CompanyId, 
    RPT_Company.RegistrationNumber, 
    RPT_Company.Address, 
    RPT_Company.MobileNumber, 
    RPT_Company.FaxNumber, 
    RPT_Company.CompanyEmail, 
    RPT_Company.CompanyWebsite, 
    RPT_Company.VatTinNumber
FROM 
    (RPT_Invoice_Less 
    INNER JOIN RPT_Customer 
        ON RPT_Invoice_Less.CustomerId=RPT_Customer.CustomerId) 
    INNER JOIN 
    RPT_Company 
        ON RPT_Invoice_Less.CompanyId=RPT_Company.CompanyId;

2 个答案:

答案 0 :(得分:1)

尝试使用内置设计器尽可能地重现,如果不复制查询,我会得到一个印象,即该查询的FROM部分可能存在问题

答案 1 :(得分:1)

谢谢你们,最后我解决了你的想法和我目前粘贴在下面的代码

SELECT RPT_Invoice_Less.InvoiceNumber, RPT_Invoice_Less.Terms, RPT_Invoice_Less.Invoicedate, RPT_Invoice_Less.OurQuote, RPT_Invoice_Less.SalesPerson, RPT_Customer.CustomerName, RPT_Customer.CustomerId, RPT_Customer.ContactPerson, RPT_Customer_Address.BillingAddress, RPT_Customer_Address.DeliveryAddress, RPT_Invoice_Less.OrderNumber, RPT_Invoice_Less.ShippingBy, RPT_Invoice_Less.ShipReferenceNo, RPT_Invoice_Less.Notes, RPT_Invoice_Less.Price, RPT_Invoice_Less.Discount, RPT_Invoice_Less.Shipping, RPT_Invoice_Less.Tax, RPT_Invoice_Less.GrandTotal, RPT_Company.CompanyName, RPT_Company.CompanyId, RPT_Company.RegistrationNumber, RPT_Company_Address.Address, RPT_Company.MobileNumber, RPT_Company.FaxNumber, RPT_Company.CompanyEmail, RPT_Company.CompanyWebsite, RPT_Company.VatTinNumber

FROM (((RPT_Invoice_Less INNER JOIN RPT_Customer ON RPT_Invoice_Less.CustomerId = RPT_Customer.CustomerId) INNER JOIN RPT_Company ON RPT_Invoice_Less.CompanyId = RPT_Company.CompanyId) INNER JOIN RPT_Company_Address ON RPT_Invoice_Less.CompanyId = RPT_Company_Address.AddressId) INNER JOIN RPT_Customer_Address ON RPT_Invoice_Less.CustomerId = RPT_Customer_Address.CustomerId;

此代码成功运作。