Thanks Igor,
What are the pros and cons of this approach vs. using a temporal table as 
suggested by Keith?

Best regards,
Luis


On Sun, Jul 15, 2012 at 06:50:44PM -0400, Igor Tandetnik wrote:
> 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

-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Apdo. Postal 48-3, 62251             |                           (*)/\/  \
Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org                 


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

Reply via email to