龙之大陆迷之宫殿咋去:使用SQL查询语句将出生年月日换算成年龄,改怎么编写?

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/09 20:53:02
在查询分析器中实现

select YEAR(getdate())-YEAR(BirthDate)+1 from employees

就可以了。

select DateDiff(year,出生日期字段名,getdate()) as t_age from 你的表

select year(now())-year(birthday) from 表名

select year(getdate())-year(birthday)

select 2005-出生日期 from 表名