Summing Fields by Given Period

  • Thread starter Thread starter Tan SH
  • Start date Start date
T

Tan SH

Hi,

I have the following table (DATA_DAY)with the folloing
fields:

ObjectID, Date, Value1, Value2, Value3

I need a query that can sum up the values of Value1,
Value2, Value3 for a particular Object_ID, for a given
period. In addition, I need to insert the results of this
query into a second table, DATA_DAY_ACC. This table has
the following fields:

ObjectID, Start_Date, End_Date, Sum_Value1, Sum_Value2,
SumValue3, Comments

Help!!!

br/Tan
 
Hi,


From what I understand, a possible query could be:


SELECT ObjectID,
MIN(dateTime),
MAX(dateTime),
SUM(Value1),
SUM(Value2),
SUM(Value3)

FROM myTable

WHERE dateTime >= [Starting Date for the interval]
AND
dateTIme < 1+[Ending Date for the interval]





Hoping it may help,
Vanderghast, Access MVP
 
Back
Top