用SQL查询学生年龄(只知道出生日期)?

2024-11-14 15:01:20
推荐回答(2个)
回答1:

select datediff(year,出生日期,getdate()) FROM 表格

回答2:

select Cast(YEAR(Getdate()) as int ) - Cast(YEAR(出生日期) as int) as age from 表名