Apologies for the late response on this but for our needs we have decided to go with Jill's recommendation (see below). It is the most efficient and logical option for us with how my entire 50 line query is structured.
AND (DATEPART('YY',CURRENT_DATE) - DATEPART('YY',Patient.BirthDate)) >= 13
I plan on trying all the answers out today. Performance will be important for this report/extract so I will be sure to update the post on which approach I take. Thank you for your answer!
go to post
Hi Everyone -
Apologies for the late response on this but for our needs we have decided to go with Jill's recommendation (see below). It is the most efficient and logical option for us with how my entire 50 line query is structured.
AND (DATEPART('YY',CURRENT_DATE) - DATEPART('YY',Patient.BirthDate)) >= 13
Thanks,
Blake
go to post
Hi Jill -
I plan on trying all the answers out today. Performance will be important for this report/extract so I will be sure to update the post on which approach I take. Thank you for your answer!
Blake
go to post
Hi Vitaliy -
Thank you very much for pointing this out as I didn't think about that!
Blake
go to post
The answer to this post has been figured out. Below is a query to get the 12 year olds who will turn 13 by the end of the current year (12/31).
select DATEDIFF('YY',birthdate,current_date) AS CalculatedAge, Age
from hsaa.patient
where DATEDIFF('YY',birthdate,current_date) = 13