I have a simple query where ultimately my goal is to count the number of certain items sold between certain dates, but I am having problems before I can even get to that. It is a simple invoice/invoice item query but it is taking unusually long to open even before even I apply any filters to it. When I do apply filters, it takes even longer to load load/open the query.
Here is the Query without any filters...
When opening the query it "opens" quickly, but if I try to scroll down or click the Last record button, it takes anywhere from 3 to 10 minutes to "load" the rest of the records. when it does complete the final number of records is 4849. Separately the invoice table holds 2689 records and the invoiceline table holds the same 4849. That doesn't seem like too large of a number, and I have dealt with queries that returned 100,000+ records which responded just fine. Other queries in the database run just fine, it just seems that when using those two tables together (invoice and invoiceline) I get this problem. Any suggestions as to what is making this so slow and how to fix it?
Here is the Query without any filters...
Code:
SELECT [Invoice].TxnID, [Invoice].TxnNumber, [Invoice].TxnDate, [Invoice].RefNumber, [Invoice].DueDate, [InvoiceLine].Size
FROM [Invoice] RIGHT JOIN [InvoiceLine] ON [Invoice].SimpleID = [InvoiceLine].SimpleID