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" <[email protected]>
>To: "General Discussion of SQLite Database" <[email protected]>
>Subject: Re: [sqlite] how to update the Moving average value
>Message-ID: <[email protected]>
>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
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to