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
..
 
Top