I have date of birth column in my table and I want to calculate the age based on the age that will reach 65 within 6 months from the date of the report generated and that would be treated as Medicare else no eligible for Medicare
I started to code in T-sql as
getdate() as today case when datediff(yy,m.date_of_birth ,getdate()) as age
case WHEN DATEADD(MONTH, DATEDIFF(YEAR,m.date_of_birth ,getdate()) ,m.date_of_birth)(I do not know wether it works )
-------
-------
-------
------
Make use of CASE when if possible
I need to display the age with the months too.
The logic should be in a such a way that you display the age in such a way (the condition is when the age reaches 64 yrs 6 months, it should treated as Medicare else no Medicare)?.