Date Query

  • Thread starter Thread starter www.ttdown.com
  • Start date Start date
W

www.ttdown.com

I have a database that I need to query. The database contains a
ClientName field and DateofService (MM/DD/YYYY) field. I need to
query the database and return only the Client Names that have some
entries in the DateofService field but don't have a DateofService in
the last 90 days. Can anyone help?

Thanks!
 
I have a database that I need to query. The database contains a
ClientName field and DateofService (MM/DD/YYYY) field. I need to
query the database and return only the Client Names that have some
entries in the DateofService field but don't have a DateofService in
the last 90 days. Can anyone help?

The format of the DateOfService is irrelevant - that merely controls
how the value is displayed.

You need the rather obscure NOT EXISTS clause in your query:

SELECT * FROM yourtable
WHERE Not Exists(SELECT ClientID FROM yourtable
WHERE DateOfService > DateAdd("d", -90, Date()))
 
Back
Top