Query for seeing what customer hasn't ordered in specific amount of time??

I have a list of customers, order numbers, order amount and order dates from three tables (below). How do I write a query to show which customers have not placed an order within the past 6 months?

SELECT Orders.OrderNo, Orders.CustCode, Orders.CustDesc, Orders.OrderTotal, Orders.DateEnt, Orders.OrderNo, OrderDet.PartNo, OrderDet.PartDesc, CustCode.Phone, CustCode.APContact, CustCode.APPhone, CustCode.BAddr1, CustCode.BAddr2, CustCode.BCity, CustCode.BState, CustCode.BZIPCode
FROM (Orders LEFT JOIN OrderDet ON Orders.OrderNo = OrderDet.OrderNo) LEFT JOIN CustCode ON Orders.CustCode = CustCode.CustCode;
Kevin SmithAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Give this a try:

SELECT c.CustCode 
(SELECT CustCode FROM Orders WHERE  DateEnt BETWEEN DateAdd("m", -6, Date())  AND Date()) o ON o.CustCode = c.CustCode

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can include other tables/fields as needed in the above query to give you the needed columns, but the keys for finding 'customers with no associated orders in the last 6 months'  are

- Get a subset of the orders table showing orders in the last 6 months (thats what the subquery does above)
- Use a LEFT JOIN so as to consider all customers
- In the criteria, look for CustCode null in the orders table/query... that is what defines 'no matching orders'
Kevin SmithAuthor Commented:
thanks...had totally forgotten to grade this, sorry.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.