我使用 Ms 访问作为我的数据库,并且我正在使用以下查询来获得工作时间:
select
in_time,
out_time,
datediff("n",b.in_time,c.out_time) as work_time,
log_date,
emp_id
from
(select
LogTime as in_time,
SrNo,
LogID as emp_id,
LogDate as log_date
from LogTemp
where Type='IN' ) as b
left join
(select
SrNo as out_id,
LogTime as out_time,
LogID as out_emp_id,
LogDate as out_log_date
from LogTemp
where Type = 'OUT'
group by SrNo) as c
on (b.SrNo <> c.out_id
and b.emp_id = c.out_emp_id
and b.log_date = out_log_date )
where
c.out_id > b.SrNo and
[log_date] >= #8/20/2012# and
[log_date] <= #8/20/2012# and
emp_id = "8"
group by b.SrNo;
但是当我执行查询时,我收到以下错误:
"you tried to execute a query that does not include the specified expression 'out_time'
as an aggregate function in ms access" error.
任何我犯错误的建议。