标签:信息 TE SQ diff unit sql查询 hda when from
select Case when DateDiff(Year, BirthDate, GetDate()) > 0 then DateDiff(Year, BirthDate, GetDate()) 
                    when DateDiff(Month, BirthDate, GetDate()) > 0 then DateDiff(MONTH, BirthDate, GetDate()) 
                    When DATEDIFF(DAY, BirthDate, GetDate()) > 0 then DateDiff(DAY, BirthDate, GetDate()) end Age,
           Case When DateDiff(Year, BirthDate, GetDate()) > 0 then ‘岁‘  
                    When DateDiff(Month, BirthDate, GetDate()) > 0 then ‘月‘
                    When DATEDIFF(DAY, BirthDate, GetDate()) > 0 then  ‘日‘ end AgeUnit, BirthDate BirthDate
From 人员信息
标签:信息 TE SQ diff unit sql查询 hda when from
原文地址:https://www.cnblogs.com/meitai/p/9175782.html