Aggregation over 5 minute periods (1 Viewer)

sambrierley

Registered User.
Local time
Today, 07:53
Joined
Apr 24, 2014
Messages
56
Hi, im unsure of the best way to achieve this so any help is greatly appreaciated.
I have several pieces of equiptment that register data every minute, is there a way to do like a 5 minute average i.e 00:00 - 00:04, 05:00 - 09:00
NOT 00:00- 05:00, 01:00- 06:00 and so on.

thanks for any help
 

MarkK

bit cruncher
Local time
Today, 07:53
Joined
Mar 17, 2004
Messages
8,180
1) Round the date/time value to the nearest 5 minutes.
2) Write a GROUP BY query that groups by that newly rounded date/time
3) Use the Avg() function

Query 1:
SELECT MyRoundToFunction(DateTimeValue, 5) As RoundedDateTime, SensorValue
FROM MyTable

Query 2:
SELECT RoundedDateTime, Avg(SensorValue) As AvgSensor
FROM Query1
GROUP BY RoundedDateTime
 

sambrierley

Registered User.
Local time
Today, 07:53
Joined
Apr 24, 2014
Messages
56
Thank you very much
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 15:53
Joined
Jul 9, 2003
Messages
16,280
Thank you very much

Due to a bug in the forum software this message was "unapproved" (hidden) for some considerable time. I have just approved it. I hope no one has been inconvenience too much! The new forum software no longer has this bug, so this problem should not reoccur.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:53
Joined
Sep 12, 2006
Messages
15,652
try looking at the access partition function. It's little known, but does that sort of thing.

(now I see this is an old post, but no matter)
 

Users who are viewing this thread

Top Bottom