计算出生日期后90天 [英] calculating 90 days after date of birth
本文介绍了计算出生日期后90天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是SQL新手,需要了解以下内容。在我的Excel电子表格中,我有患有uniqueID及其出生日期(DOB)的患者。
如何使用第一个生日后90天的新列编写查询?
EX:如果患者的DOB是2012年4月23日,结果应该是2013年7月22日。
谢谢!
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!
推荐答案
dateadd(dd,90,cast(dob as datetime))
错过了1岁生日部分
这里是答案
dateadd(dd,90,dateadd(yy,1,cast(dob as datetime)))
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)))
这篇关于计算出生日期后90天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文