select round(((select avg(close) from test2 b where b.tkid between a.tkid-12 and a.tkid) - (select avg(close) from test2 b where b.tkid between a.tkid-26 and a.tkid)),2) from test2 a
could be select the result,but when update use this sql script: update test2 set diff =(select round(((select avg(close) from test2 b where b.tkid between a.tkid-12 and a.tkid) - (select avg(close) from test2 b where b.tkid between a.tkid-26 and a.tkid)),2) from test2 a) all of the result is 0 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users