On 13 Feb 2012, at 7:51pm, Steinar Midtskogen wrote: > One should think that the ability to calculate a moving average would > be a pretty common request. But people do it in their application > code instead?
Actually, my expectation is the other way. I'm continually surprised by posts on this list that people expect to be able to use SQLite with no external programming at all. I often see complicated compound JOIN and sub-SELECT SQL commands here which can be replaced by four lines in any programming language, yielding faster simpler code which would be easier to document and debug. There are a few posters here who don't know how to program, and I can understand them wanting a SQL expression to do all the work for them. But really, anyone who can understand anything more than a simple JOIN can learn how to program and it'll probably save them time in the long run. Your requirement does seem to be difficult because it requires an aggregate function applied after ORDER BY. The easiest way to implement it involves defeating some of the optimization in SQLite, thus worsening it for most users. But as someone who does know how to program, I'd expect to do it by handing a 'SELECT' statement to a function I'd written. I wouldn't expect a tiny simple fast API like SQLite to do it, and writing a simple routing in whatever programming language the rest of my code is written in would be far easier for me than writing a SQLite extension in C. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users