Difference between two dates

P

P. B. Friday

I am trying to create a queries that tell informs me when
an employe is one year before the retirement age of 62
and another one that notifies me five days before an
employee's date of birth. I assume that I have to use the
DATEDIFF functin. Help!
 
J

John Spencer (MVP)

For Retirement list

SELECT * FROM TableName
WHERE DateAdd("yyyy",61,DOB) >= Date()

Or perhaps faster
SELECT * FROM TableName
WHERE DOB < DateAdd("yyyy",-61,Date())

For DOB and exactly five days.
SELECT * FROM Tablename
WHERE DateSerial(Year(Date()),Month(DOB),Day(DOB)-5) = Date()
 

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

Top