I have a table that stores the date of birth of patients in DateTime format(2022-06-22).
How can I get the age in years for people born in July?
I have tried the below:
select sFirstName,
sLastName,
dDateOfBirth,
DATEDIFF(yy,dDateOfBirth,GETDATE()) as Age,
ifkMedicalAidID
from Patients
where DATEDIFF(month,dDateOfBirth,GETDATE()) between 5 and 5
Although I get only all the records for July(which is correct) all the ages are 0, I see the problem with the above query but I don't have the SQL knowledge to resolve it...