Figure months from a anchor date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Lets say a child was born on 5-15-2004. (dob = Field 1)
There is an immunization SERVICE date (Field 2) of 5-18-2005

I need to write a query that will show me ONLY the children that had a
SERVICE DATE (above) within 12 months. Any help will be appreciated
Buck
 
Lets say a child was born on 5-15-2004. (dob = Field 1)
There is an immunization SERVICE date (Field 2) of 5-18-2005

I need to write a query that will show me ONLY the children that had a
SERVICE DATE (above) within 12 months. Any help will be appreciated
Buck

SELECT <whatever>
FROM <your table name>
WHERE DateDiff("m", [DOB], [SERVICE DATE]) <= 12


John W. Vinson [MVP]
 
buckpeace said:
Lets say a child was born on 5-15-2004. (dob = Field 1)
There is an immunization SERVICE date (Field 2) of 5-18-2005

I need to write a query that will show me ONLY the children that had a
SERVICE DATE (above) within 12 months. Any help will be appreciated


SELECT *
FROM table
WHERE servicedate <= DateAdd("yyyy", 1, dob)

or
WHERE servicedate <= DateAdd("m", 12, dob)
 
Back
Top