select dexin, code,new, (select avg(new) from tb1 where dexin between dexin-3 
and dexin)as mavg from tb1;

the result is only one value, 
and table only one:  tb1
I don't know why have tbl b and tbl a





>From: "Keith Medcalf" <kmedc...@dessus.com>
>To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
>Subject: Re: [sqlite] how to update the Moving average value
>Message-ID: <545265ad8b7cfb45b4f7f9160b8cc...@mail.dessus.com>
>Content-Type: text/plain; charset="us-ascii"
>
>
>select id, sales_vol, (select avg(sales_vol) as mavg 
>                         from tbl b
>                        where b.id between a.id - 3 and a.id)
>  from tbl a;
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to