need SQL to average values over time interval

  • Thread starter Thread starter Martin Payne
  • Start date Start date
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
 
SELECT Avg(timer_vals.measured_val) AS AvgMeasure,
Minute([measurement_time]) AS MinMeasured
FROM timer_vals
GROUP BY Minute([measurement_time]);
 
Perfect! Do you know anywhere I can find help on the minute function?

Many thanks,
Martin
 
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.
 

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

Back
Top