Hi all,
I have a data table that holds machine statistics,
My data table consist of (Date,Time,Good_Parts,...)
The date and the time fields tell us when the information have gotten to the table.
My table looks like :
Date time Good_Parts
22/8/04 10:05:02 200
21/8/04 9:05:02 500
20/8/04 5:05:02 1000
I want to make a query that calculates, how many parts do we have from first day to second day.(e.g: 800 from 20~22/8/04,500 from 21~22/8/04...)
The problem is that maybe in a certain day we have more than on reading,(for example,one reading in the morning and another in the evenning)
So, to get the right difference,we have to take the latest number in the second date minus the early number of the first day,then we have how many parts the machine did all the day).
How I can do a query that has also day and time to make the right calculation. I built aquery that do that,but only with date.
here you have My SQL code of the problem:

G: (Select sum(Good_Parts) from data where (date=[forms]![Get_Counters]![End_Date] and Machine=Machines!Machine))-(Select sum(Good_Parts) from data where (date=[forms]![Get_Counters]![Begin_Date]and Machine=Machines!Machine)).
Machine: is the machine number.Begin and End dates are gotten from the form.
Thanks a lot