Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QUERY SYNTAX IS NULL BETWEEN

Status
Not open for further replies.

maeling

Technical User
Sep 23, 2002
109
GB
Hello,
I have a query I am trying to get to work and can't quite work it out.
I have a date field called visit_date. Everytime one of my users visits a customer he enters record and the date for the record is create =date()
I would like to query for customers taht have not had a visit for the last three months ? Can I do this ?
 
Perhaps something like this ?
SELECT CustomerID, Max(visit_date) As LastVisit
FROM yourTable
GROUP BY CustomerID
HAVING (Max(visit_date)<Date()-90) OR (Max(visit_date) Is Null)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top