December 21, 2009 at 4:45 am
Hi ..
I have Table which Consists of the following Data in it ..
Datetime Data
2009-11-08 18:37:08.080 1.45898
2009-11-08 18:52:08.0830.682263
2009-11-08 19:07:08.0900.377801
2009-11-08 19:22:08.09715.1342
2009-11-08 19:37:08.1030.454472
2009-11-08 19:52:08.1070.643372
2009-11-08 20:07:08.113304.813
2009-11-08 20:22:08.120458.35
2009-11-08 20:37:08.1270.814493
2009-11-08 20:52:08.130274.853
2009-11-08 21:07:08.137106.836
2009-11-08 21:22:08.14311.8152
2009-11-08 21:37:08.1470.531143
2009-11-08 21:52:08.1530.51892
2009-11-08 22:07:08.1530.423359
.
.
.
.
.
.
2009-12-15 03:20:20.00313.2219789351478
For this table data i need to calculate the 4 week moving average ,and add it as a additional column to this table representing it as "moving average"
How to write a sql query .
Can any one help me out ...
December 21, 2009 at 5:43 am
Several questions:
1) Does "4 weeks" mean to calculate the average for full weeks or is 4 weeks = last 28 days? Based on your example: Dec. 15th is a Tuesday. What data should be included in those "4 weeks"?
2) Do you need to calculate backward or forward? Meaning: need the values be stored to the first day or the last day of the 4 week period?
3) Do you need to fill that addtl. column when new values are added or do you plan to calculate the values separately?
Finally, please read and follow the first link in my signature on how to post sample data. We'd like to get ready to use data together with some expected results to test against.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply