2016-08-10 17:13 GMT+02:00 Cecil Westerhof <cldwester...@gmail.com>: > Question 2: > >> Not sure how you want to slice data, I am assuming you mean you want to >> know how many values (as in percent of total) falls within each slice? If >> so, this should work: >> > > Yes, that is what I mean. I am going to try it out. > > > > >> WITH ST(cAll) AS ( >> SELECT COUNT(*) FROM vmstat >> ), SL(Slice) AS ( >> SELECT (CAST(((100 * COUNT(*) / ST.cAll) / 5) AS INT) * 5) >> FROM vmstat, ST >> ) >> SELECT Slice||' - '||(Slice+5), (100 * COUNT(*) / ST.cAll) AS Perc >> FROM SL, ST >> GROUP BY Slice >> >> [Might need a little fiddling to produce the output exactly how you want >> it, but the basics should be clear] >> > Does not work. SL gives a table that has exactly one element.
-- Cecil Westerhof _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users