![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Re: moving average
On Sep 14, 10:20*am, nintesa <nint...@nomaaaaail.it> wrote:
> I have a table: > > Date, Value > > and I need to calculate a "moving average" for value... does exist a > function for that in mysql? Depending on the form of your data and exactly how you want to calculate the average, a self-JOIN may help you do this. Can you give more details? > > Thanks! |
|
|||
|
Re: moving average
On Sep 14, 10:20*pm, nintesa <nint...@nomaaaaail.it> wrote:
> I have a table: > > Date, Value > > and I need to calculate a "moving average" for value... does exist a > function for that in mysql? > > Thanks! A subquery might also help under certain conditions. Here's an example of a moving 10 window average: SELECT (SELECT AVG(value) FROM table t2 WHERE t2.id <= t1.id ORDER BY id DESC LIMIT 10) AS moving_ave FROM table t1; |
|
|||
|
Re: moving average
On 16 Sep, 03:54, Erol Fornoles <erol.forno...@gmail.com> wrote:
> On Sep 14, 10:20*pm, nintesa <nint...@nomaaaaail.it> wrote: > > > I have a table: > > > Date, Value > > > and I need to calculate a "moving average" for value... does exist a > > function for that in mysql? > > > Thanks! > > A subquery might also help under certain conditions. Here's an example > of a moving 10 window average: > > SELECT (SELECT AVG(value) FROM table t2 WHERE t2.id <= t1.id ORDER BY > id DESC LIMIT 10) AS moving_ave FROM table t1; Surely that's better as a self join as suggested by Toby. |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|