Summing Fields by Given Period

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
 
M

Michel Walsh

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
 

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