Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm very new to SQL and need to know the following. On my excel spreadsheet I have patients with uniqueIDs and their date of birth(DOB).

How can I write a query with the new column that has 90 days after their 1st birthday?

EX: if the patient's DOB is 4/23/2012, the outcome should be 7/22/2013.

Thanks!
Posted
Comments
[no name] 30-Jun-14 14:58pm    
Just a little bit of research...http://msdn.microsoft.com/en-us/library/ms186819.aspx

1 solution

dateadd(dd,90,cast(dob as datetime))

missed the 1st birthday part

here is the answer

dateadd(dd,90,dateadd(yy,1,cast(dob as datetime)))
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900