Let's say that I want to plot the entire column and the plot is 1000 pixels wide. Then I only need 1000 samples, so I could do this:
SELECT timestamp, sample FROM mytable GROUP BY timestamp * 1000 / ((SELECT max(timestamp) FROM mytable) - (SELECT min(timestamp) FROM mytable)); (timestamp is the primary key) -Steinar Steinar Midtskogen <stei...@latinitas.org> writes: > [Jean-Christophe Deschamps] > >> You're going to have at most one random sample in every slice of 320 >> s. The GROUP BY clause will select only one for you and the query can >> be as simple as: >> >> select sample from from mytable group by timestamp / 320 order by >> timestamp; > > Ah. I didn't think of that. It's even better than getting every nth > row, since I get one sample for a fixed period, which is what I really > want. And yet better, I suppose I could do something like SELECT > min(sample), max(sample) FROM mytable GROUP BY timestamp / 3600 and > use financebars or similar in gnuplot to avoid missing the extremes in > the plot, making it appear more or less identical as if I had plotted > every value. > > Thanks! > -- > Steinar > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users