データベースとして 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.
私が間違いを犯している提案。