Keith Metcalf wrote:

>id  Sales_vol      mov_avg
>1    1            
>2    2              
>3    3          =(1+2+3)/3
>4    5          =(2+3+5)/3
>5    4          =(3+5+4)/3
>6    2          =(5+4+2)/3
>7............

>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;

- 3 should be - 2. You're working with the last 4 days and might get an error 
if id=3
:P
 

Cordiali saluti/Vriendelijke groeten/Kind regards,
Klaas V

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

Reply via email to