ms Access SQL中的Avg函数出错

时间:2015-07-08 17:53:21

标签: sql ms-access ms-access-2013

在考勤表中,有一个日期/时间类型的字段TimeIn。该列中的一些数据是

14/03/2015 15:06:45

虽然有些格式为

15:08:40

想要找到员工进入Office的平均时间。因此我使用了下面的SQL

SELECT  AvgTimeIn = CAST(AVG(CAST(TimeIn as FLOAT)) as DATETIME)        
FROM tblAttendanceHrs
GROUP BY tblAttendanceHrs.Staff;

将错误视为

enter image description here

1 个答案:

答案 0 :(得分:0)

感谢Fionnuala

我使用此查询获得了平均时间

SELECT Cdate (Avg(AttandanceTbl.TimeIn)) AS AvgOfTimeIn
FROM AttandanceTbl
GROUP BY AttandanceTbl.Staff;

来源:http://bytes.com/topic/access/answers/953801-how-average-time-ms-access-2003-a