Datediff

A

Ana

Hi,

I need to build a query which lists clients who have not placed an order for
the last 2 years but don't know where to start. The fields available are:

ClientName and OrderDate among fields.

Any help is appreciated.

Ana



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

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

Jerry Whittle

SELECT DISTINCT ClientName
FROM YourTable
WHERE DateAdd("yyyy",-2,[OrderDate]) < Date()
ORDER BY ClientName ;
 
J

John Spencer

One method.

SELECT ClientName
FROM YourTable
WHERE Exists
(SELECT T.ClientName
FROM YourTable as T
WHERE T.ClientName = YourTable.ClientName
AND T.OrderDate > DateAdd("YYYY",-2,Date())) = False

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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

playing w/dates 2
Divide by 0 error 1
Hiding info on page header 1
DOB 9
API function 0
Storing dates 8
ADE problem 2
DB connection Q: 0

Top