Access 2000

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a table for orders and customers. i need to do a query for the
customers who have not placed an order in the last 365 days.
 
i have a table for orders and customers. i need to do a query for the
customers who have not placed an order in the last 365 days.

A "Not Exists" subquery will do the trick here:

SELECT Customers.*
FROM Customers
WHERE Not Exists
(SELECT CustomerID FROM Orders
WHERE Orders.CustomerID = Customers.CustomerID
AND SaleDate >= DateAdd("yyyy", -1, Date());


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top