AlphaPress Publishing
P.O. Box 5942 Albany, NY 12205
Tel: 518-250-3890


Section Menu 

Are you a University or College bookstore and want to order multiple books?  Email us at or call us at 518-250-3890.  We will be happy to talk to you.  

Are you a professor and you need a sample copy?  We will be happy to send you a pdf or printed copy!  Email us at

Are you outside the United States?  We can ship multiple books worldwide in most countries.




How to Use the IN Operator with Dates and Subqueries

To contact the author click here

This article is from the book "Access 2007 Pure SQL

To download the sample database click here

The IN operator with subqueries and dates

Find customers who have not placed any orders in the second half of 2009


Our task in this scenario is to find customers who have not placed any orders in the second half of the year 2009.  Management needs this information for initiating promotions to inactive customers.  To achieve this task, we will use the NOT IN and BETWEEN operators and a subquery.  Remember that the purpose of the subquery is always the same—to generate a list of values to be used by the IN operator.  Here, the subquery will generate a list of CustomerIDs from the Orders table, which will be used by the main query to filter records from the Customers table.  In total, 70 customers have not ordered anything during this six-month period. 



FROM Customers


(Select CustomerID FROM Orders WHERE

OrderDate BETWEEN #6/1/2009# AND #12/1/2009#)