SQL Server Date when member turns 65 -


i need find date of member gonna turn 65 or 19. have dob , age.

need date shows when turn 19 or 65.

  id    dob        age   date_turning_65_or_19   --------------------------------------------   2   1952-09-30   64       2017-09-30 

i need last column result

please me doing it.

i trying different formulas not working.

i tried this

case     when month(getdate()) <= month(dateofbirth)            , datediff(year, dateofbirth, getdate()) = '65'       convert(date, convert(varchar(2), month( dateofbirth)) + '/' +  convert(varchar(2), day(dateofbirth))  + '/' + convert(varchar(4), year(getdate())))    when datediff(year, '19510901', getdate()) = '64'       convert(date, convert(varchar(2), month( dateofbirth))  + '/' +  convert(varchar(2), day(dateofbirth)) + '/' + convert(varchar(4), year(getdate() + 365.25))) 

select *,         case when dateadd(year, 19, dob) < getdate()             dateadd(year, 19, dob)              else dateadd(year, 65, dob)         end your_table 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -