I currently have a query that is meant to pick all customers who have not paid any of their purchases this year. A customer can have many purchases, and if they've paid even one, their number should not be selected. The query I'm using is this:
SELECT DISTINCT [CustomerID]
FROM [tbl: Sales]
WHERE [CustomerID] NOT IN (SELECT [CustomerID] FROM [tbl: Sales] WHERE Not [PaidAmount] Is Null)
The query works fine but is very slow. I've been searching through the forums and it seems like using "NOT IN" is the problem.
Does anyone have any suggestions for either speeding this query up or changing the design so I don't have to use "NOT IN"?
SELECT DISTINCT [CustomerID]
FROM [tbl: Sales]
WHERE [CustomerID] NOT IN (SELECT [CustomerID] FROM [tbl: Sales] WHERE Not [PaidAmount] Is Null)
The query works fine but is very slow. I've been searching through the forums and it seems like using "NOT IN" is the problem.
Does anyone have any suggestions for either speeding this query up or changing the design so I don't have to use "NOT IN"?