jeudi 8 octobre 2015

SQLite calculate multiple averages of entire columns at a specified step?

I have a column with 10K rows. I sketched out a simple plot here to explain what I am trying to do.

The black line is the plot of all the 10K values in the column. The red line is what I am trying to get, that is my question. I want to be able to draw a line (the red line) with far less number of points, but still being able to represent the "trend" of the 10K points (black line).

I thought about querying the database with an offset and limit a bunch of times and each time getting the AVG of each range I queried for. With that I would then have a much smaller subset that would allow me to draw the red line (fewer points).

Is there a better way using SQLite queries to achieve the same result?

enter image description here

Aucun commentaire:

Enregistrer un commentaire