SQL Query question
Posted on 2013-01-17
Good day. I am trying to use the following to find the Age as of a specific date (11/1/12). It doesn't seem to work for all. On some, the age does match what it should be but on some it adds an extra year.
DOB field contains dates as "1997-06-06 00:00:00.000"
The query is CAST(Round((DateDiff(d,id.DOB,'2012-11-01')/365.25),0) as INT) as AGE
For instance, I have one record where the DOB field is "1995-05-01 00:00:00.000" and the Age comes out as 18 but should be 17.
Any idea how I can get it so that it provides the proper age as of the date requested?