that will make my problem more clear
let it be an employee mgmt system
i have
EID (PK)
Date of birth (datetime)
date of joining (datetime)
date of retirement(datetime)
date of death (date time)
i do not have to calculate age till today but i want to calculate age till date of retirement or date of death(if available)
i want to declare a new column "age" and keep the records of every employee in it
i have a query working for it
select case when not death is null then
datediff(year, birth, death )
else datediff(year , birth, date_of_retirement ) end from Table_3
it works ok, but i want to save the results in "age"