playing w/dates

R

Ron

Hi,

I've customers (client_id, customer_name) who have ordered (order_id) items
during the year (date_in) and than stopped ordering. I'd like to list the
customers who have not placed an order for the last 6 months. Can someone
help?

TIA

Ron



--------------------------------------------------------------------------------

Estoy utilizando la versión gratuita de SPAMfighter para usuarios privados.
Ha eliminado 1393 correos spam hasta la fecha.
Los abonados no tienen este mensaje en sus correos.
¡Pruebe SPAMfighter gratis ya!
 
T

tina

try a Totals query on the CustomerOrders table, GroupBy client_id (and
customer_name if you want) and Max date_in, with criteria on the "Max
date_in" field of

<DateAdd("m", -6, Date())

hth
 
J

John Vinson

Hi,

I've customers (client_id, customer_name) who have ordered (order_id) items
during the year (date_in) and than stopped ordering. I'd like to list the
customers who have not placed an order for the last 6 months. Can someone
help?

a Not Exists clause will do this:

SELECT * FROM Customers
WHERE NOT EXISTS
(SELECT Customer_ID FROM Orders
WHERE Date_In > DateAdd("m", -6, 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

Similar Threads

Divide by 0 error 1
Datediff 2
Hiding info on page header 1
Port 21 blocked? 3
DOB 12
Storing dates 8
ADE problem 2
Local tables vs. linked 3

Top