I want to find moving average of the past 30 days. for example
Today's date is 17/11/15, I have data only the days
Original Data
date qty
06/11/15 5
08/11/15 7
09/11/15 8
10/11/15 12
11/11/15 34
15/11/15 45
16/11/15 12
17/11/15 7
Find 30 day Moving Average Data - Need to get movingAvg just like in below table -movingAvg column
date qty movingAvg
17/10/15 0 0
18/10/15 0 0
19/10/15 0 0
20/10/15 0 0
21/10/15 0 0
22/10/15 0 0
23/10/15 0 0
24/10/15 0 0
25/10/15 0 0
26/10/15 0 0
27/10/15 0 0
28/10/15 0 0
29/10/15 0 0
30/10/15 0 0
31/10/15 0 0
01/11/15 0 0
02/11/15 0 0
03/11/15 0 0
04/11/15 0 0
05/11/15 0 0
06/11/15 5 0.14
07/11/15 0 1.4
08/11/15 7 0.4
09/11/15 8 0.67
10/11/15 12 1.06
11/11/15 34 2.2
12/11/15 0 2.2
13/11/15 0 2.2
14/11/15 0 2.2
15/11/15 45 3.7
16/11/15 12 4.1
17/11/15 7 4.33
Please help me out with the mysql query for this or if there is any alternate for this.