YAN HONG YE <yanhong...@mpsa.com> wrote:
> 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

update test2 set diff = round(
    (select avg(b.close) from test2 b where b.tkid between test2.tkid-12 and 
test2.tkid) -
    (select avg(b.close) from test2 b where b.tkid between test2.tkid-26 and 
test2.tkid)
, 2);

-- 
Igor Tandetnik

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

Reply via email to