Luis Mochan <moc...@fis.unam.mx> wrote:
> I want to reorder a table and then group and average it's values. I
> tried something similar to
> 
> SELECT AVG(a) FROM (SELECT a FROM table ORDER BY a) group by ROWID/10;
> 
> in order to take the average 'a' for groups of 10 succesive values.

Something like this perhaps:

select avg(a) from MyTable t1
group by (select count(*) from MyTable t2 where t2.a < t1.a) / 10;

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to