need SQL to average values over time interval

M

Martin Payne

I have a table of records, 'timer_vals', that contains a large number
of records each of which has an integer value between 1 and 10,
'measured_val', and a time value, 'measurement_time'. The range for
measurement_time over all records is 1 hour (all measurements were made
within the period of an hour).

How do I go about writing an SQL statement that will tell me what the
average measured_val was for each minute of that hour (the result set
should contain 60 records)?

Thanks in advance,
Martin
 
B

Brendan Reynolds

SELECT Avg(timer_vals.measured_val) AS AvgMeasure,
Minute([measurement_time]) AS MinMeasured
FROM timer_vals
GROUP BY Minute([measurement_time]);
 
M

Martin Payne

Perfect! Do you know anywhere I can find help on the minute function?

Many thanks,
Martin
 
B

Brendan Reynolds

Just enter the word 'minute' in the Immediate window (Ctrl+G will open the
Immediate window), make sure the insertion point is somewhere in or
immediately after the word 'minute' (i.e. don't add any spaces or press
enter) and press F1 for context-sensitive help.
 
Top