Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How summarize production by date/time

Status
Not open for further replies.

DonHind

Programmer
Dec 25, 2001
4
US
We make rolls of cloth. My table has fields [StockCode], [RollNumber], [RollWeight], [RollDateTime]. We have production runs that last from 6 hrs to 3 days with rolls coming off the machine every 15 minutes or so. I want write a query to be able to calculate the number of rolls, total weight of rolls and pounds per hour for a stock code between the time the first roll comes off and the time the last roll comes off. Thanks for any help
 
DonHind,
Something like:
[tt]SELECT StockCode, COUNT(RollNumber) AS RollCount, SUM(RollWeight) AS RollWeight, SUM(RollWeight)/DateDiff("h",MIN(RollDateTime),MAX(RollDateTime)) AS RollPPH
FROM YourTable
GROUP BY StockCode;[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top