Totals from Instances (not of instances)

Ksan

Flailling in the dark
Local time
Today, 18:42
Joined
Oct 26, 2005
Messages
36
I've come across an interesting problem a colleague has been trying to solve and even though I can 'see' what needs to be done and could probably program it on our mainframe, I'm really stuck on how to achieve the same results in MS Access

I'll do my best to explain the problem by showing an example of how the data exists in the DB and also how it 'should' be output on a report.

DATE OPERATOR COUNT

29/06/06 - Oper A - 32
29/06/06 - Oper B - 12
29/06/06 - Oper A - 10
29/06/06 - Oper C - 13
29/06/06 - Oper B - 10

The output needed however should read as follows

29/06/06 - Oper A - 42
29/06/06 - Oper B - 22
29/06/06 - Oper C - 13

Setting up a date selection shouldn't be a problem, its just adding the totals on each instance of each operator into one figure without ending up with a total of the number of times an operator appears on a date.

Any help and guidance about how best to approach this problem (macro/query/script) would be appreciated.
 
SELECT Date, Operator, Sum(Count)
FROM tablename
GROUP BY Date, Operator
ORDER BY Date, Operator;

By the way, you may find that using reserved words like Count and Date as field names will cause you issues later on.
 
Point noted.

Thanks for your help, a nice straight-forward answer even I can get my head around. :)
 

Users who are viewing this thread

Back
Top Bottom