📜  如何在python中根据出生日期计算年龄 - SQL代码示例

📅  最后修改于: 2022-03-11 15:05:23.498000             🧑  作者: Mango

代码示例4
SELECT CASE WHEN dateadd(year, datediff (year, DOB, getdate()), DOB) > getdate()
            THEN datediff(year, DOB, getdate()) - 1
            ELSE datediff(year, DOB, getdate())
       END as Age
FROM