Calculating the sum of a field

T

Tommy2326

I'm trying to create a query that will show machine running times. There are
three times that will be included in the query:

Total Available Time
Running Time
Downtime

Total Available Time is a standard time and is always constant. The data
for Running Time and Downtime are recorded in a table and also used in other
queries. I am wanting to show the sum of the Downtime and the sum of the
Running Time. The field with the downtime is called 'Downtime (Min)' and
the field with the running time is called 'Running Time (Mins)'

Tommy
 
D

Duane Hookom

What have you tried?
Did you click the "Sum" button in the query design?
Where are you storing "Total Available Time" for each machine?
Do you want to group this query by machine or date or production line or ...?
Can we assume your minute fields are numeric?

Generically, your SQL might look like:
SELECT FieldA, Sum(FieldB) as SumB
FROM tblA
GROUP BY FieldA;
 
M

Marshall Barton

Tommy2326 said:
I'm trying to create a query that will show machine running times. There are
three times that will be included in the query:

Total Available Time
Running Time
Downtime

Total Available Time is a standard time and is always constant. The data
for Running Time and Downtime are recorded in a table and also used in other
queries. I am wanting to show the sum of the Downtime and the sum of the
Running Time. The field with the downtime is called 'Downtime (Min)' and
the field with the running time is called 'Running Time (Mins)'


Is your problem as simple as:

SELECT machine,
Sum([Running Time (Mins)]) As TotalRunTime
Sum([Downtime (Min)]) As TotalDownTime
FROM yourtable
GROUP BY machine
 

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