使用DOB计算Access中表中的AGE [英] Calculating AGE in a Table in Access using the DOB

查看:124
本文介绍了使用DOB计算Access中表中的AGE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法正确计算我的数据库表中的AGE字段的公式。

解决方案

ciao Linda,


应用这个sql谓词,你可以计算年龄:



SELECT Imp2.IDImpiegato,


          Imp2.DataNascita,


         年(日期()) - 年份([datanascita])AS eta,


          格式


([datanascita]," mmdd")>格式


(Date()," mmdd")AS toAdd,


          的则DateDiff(QUOT; YYYY" [datanascita],日期())+(格式


I can't get the formula right for calculating the AGE field in the TABLE of my database.

解决方案

ciao Linda,

applying this sql predicate, you can calculate the age :

SELECT Imp2.IDImpiegato,

          Imp2.DataNascita,

          Year(Date())-Year([datanascita]) AS eta,

           Format


([datanascita],"mmdd")>Format


(Date(),"mmdd") AS toAdd,

           DateDiff("yyyy",[datanascita],Date())+(Format


这篇关于使用DOB计算Access中表中的AGE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆