Joe Robbo said:
im trying to total the amounts of a field named LikelyDuration in a
query.
This is the code i have:
Expr1: Sum(LikelyDuration])
this does not seem to work however. i get this error message:
"You tried to execute a query that does not include the specified
expression
'AbsenceLineID' as part of an aggregate function".
What am i doing wrong?
Joe Robbo,
Please include the SQL for the query(ies) involved.
Sincerely,
Chris O.
yeah, i suppose that would be useful!
:
Joe Robbo,
SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine;
The GROUP BY clause is missing.
Change the query to:
SELECT tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy
,Sum([LikelyDuration]) AS Length
FROM tblAbsenceLine
GROUP BY tblAbsenceLine.AbsenceLineID
,tblAbsenceLine.AbsenceID
,tblAbsenceLine.AbsenceReasonID
,tblAbsenceLine.Date
,tblAbsenceLine.LikelyDuration
,tblAbsenceLine.WorkRelated
,tblAbsenceLine.NotifiedBy;
I can't tell without your seeing the structure of your tables and the
data in them and the appearance of your expected output, but just from
the way this Query is done, I'm thinking that it won't produce the
output you are looking for (if I'm wrong, then don't worry about what
I just said).
Sincerely,
Chris O.