sum a field in a report

L

lynn

I am having a bit of a problem getting my head round
something which I am sure is quite simple!
I am trying to produce a report which displays the total
absent days in the past 12 months. Each absence is
recorded in the absence table against the individuals name
in the form of so many days (ie absence 1= 4 days, absence
2=1 day). I want to total these amounts so the report
displays the total days absent (ie 5)
The report is based on a query which includes the absence
table, but I dont know where to put the calculation - in
the query or in the report. and which function do I use? I
have tried Sum() but it doesnt give me the required result.
Any ideas??
 
R

Rod

Assuming the field is an integer field you should be able
to use the sum(days_absent) in the query to make it work.
(If not you'll have to cast it.)

Select name, sum(days_absent) from table1 where
workdate between (date1 and date2)

This does force you to give up any extra data you might
want to include in the query. If you need additional data
in the query, then you'll have to do the summing in the
report.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top