c***@gmail.com
2006-12-18 23:40:29 UTC
Hi All,
I've been racking my brain trying to figure out some sort of Sub-Select
mySQL statement that will create a result with multiple rows of
averaged values over a years time.
What I have is weather data. There is a new record every 5 minutes,
every day. So. What I want to do with one SQL statement is figure out
the Average of those 5 minute records over each day, for every day of
the year.
I've tried what seems now like a thousand different queries but i'm not
grasping something, I'm falling down when I try to figure out how to
continue selecting the range of records each day. I humbly ask if
someone here could make sense of it.
My dataset is very simple.
Table: archive
Fields: RecordTime (format is 20060101 120000), OutTemp
If I were to take another stab at it pseudo-code like it I'd do
something like
SELECT * FROM archive Where RecordTime is 2006 AND (SELECT AVG(OutTemp)
WHERE RecordTime is between 00:00 and 24:00)
It's figuring out how to replace the hours with something that COUNTS
(?) every instance of that range?
I'm confusing myself more just typing this message.
I should go lie down or something :)
Thank you any and all for your help.
Chris
I've been racking my brain trying to figure out some sort of Sub-Select
mySQL statement that will create a result with multiple rows of
averaged values over a years time.
What I have is weather data. There is a new record every 5 minutes,
every day. So. What I want to do with one SQL statement is figure out
the Average of those 5 minute records over each day, for every day of
the year.
I've tried what seems now like a thousand different queries but i'm not
grasping something, I'm falling down when I try to figure out how to
continue selecting the range of records each day. I humbly ask if
someone here could make sense of it.
My dataset is very simple.
Table: archive
Fields: RecordTime (format is 20060101 120000), OutTemp
If I were to take another stab at it pseudo-code like it I'd do
something like
SELECT * FROM archive Where RecordTime is 2006 AND (SELECT AVG(OutTemp)
WHERE RecordTime is between 00:00 and 24:00)
It's figuring out how to replace the hours with something that COUNTS
(?) every instance of that range?
I'm confusing myself more just typing this message.
I should go lie down or something :)
Thank you any and all for your help.
Chris