I have data as below, which is partial and few rows are missing. I need an average with data considering the previous available value. Do we have any function available for such an average in sql?
Needed average: 220
Available data for 10 days:
1st day: 100
4th day: 200
7th day: 300
10th day: 400
Putting the same in a table format:
Rows Date Partial Continuous(needed)
1 01-Aug-18 100 100
2 100
3 100
4 04-Aug-18 200 200
5 200
6 200
7 07-Aug-18 300 300
8 300
9 300
10 10-Aug-18 400 400
-----------------------------------
Average 250 220
-----------------------------------
I am looking at something like select avg(partial*(nextdate-date))/(lastdate-firstdate) from mytable;