Igor, that is exactly what I need. I also understand how it is done now. Thanks!
gert 2013/11/2 Igor Tandetnik <i...@tandetnik.org> > On 11/2/2013 1:06 PM, Gert Van Assche wrote: > >> All, I have this table: >> >> DROP TABLE T; >> CREATE TABLE T (N, V, G); >> INSERT INTO T VALUES('a', 1, 'x'); >> INSERT INTO T VALUES('b', 3, 'x'); >> INSERT INTO T VALUES('c', null, 'x'); >> INSERT INTO T VALUES('d', 80, 'y'); >> INSERT INTO T VALUES('e', null, 'y'); >> INSERT INTO T VALUES('f', 60, 'y'); >> INSERT INTO T VALUES('g', null, 'y'); >> INSERT INTO T VALUES('h', null, 'z'); >> INSERT INTO T VALUES('i', 111, 'z'); >> >> I would like to see where N='c', V as the average for the group (G) were >> this record belongs to (so 'x'). >> >> Thus where N='c' I would get 2, and where N='e' or 'g', it would be 70, >> and >> where N=h it would be 111. >> > > I'm not sure I quite follow, but something like this perhaps: > > update T set V = (select avg(V) from T t2 where T.G = t2.G) > where V is null; > > -- > Igor Tandetnik > > _______________________________________________ > 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