Re: [sqlite] how to update the Moving average value

2012-08-13 Thread Steinar Midtskogen
Earlier this year I was bothering this list with many questions about the sqlite virtual table support, because I needed (among other things) an efficient way to compute moving averages. And here is the result, free for anyone to play with: http://voksenlia.net/sqlite3/interpolate.c Rather

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread Keith Medcalf
Kaminskiy > Sent: Sunday, 12 August, 2012 20:49 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] how to update the Moving average value > > Keith Medcalf wrote: > > You are right Klaas, it should be -2 not -3. You could always constrain id > to (MAXINT &g

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread Keith Medcalf
N HONG YE > Sent: Sunday, 12 August, 2012 19:31 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] how to update the Moving average value > > select dexin, code,new, (select avg(new) from tb1 where dexin between dexin-3 > and dexin)as mavg from tb1; > > the

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread Yuriy Kaminskiy
>> Sent: Sunday, 12 August, 2012 12:49 >> To: SQLite MailList >> Subject: Re: [sqlite] how to update the Moving average value >> >> Keith Metcalf wrote: >> >> >>> id Sales_vol mov_avg >>> 11 >>> 22 >>> 3

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread YAN HONG YE
scussion 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_v

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread Luuk
On 12-08-2012 20:49, Klaas V wrote: Keith Metcalf wrote: id Sales_vol mov_avg 11 22 33 =(1+2+3)/3 45 =(2+3+5)/3 54 =(3+5+4)/3 62 =(5+4+2)/3 7 select id, sales_vol, (select avg(sales_vol) as mavg

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread Keith Medcalf
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Klaas V > Sent: Sunday, 12 August, 2012 12:49 > To: SQLite MailList > Subject: Re: [sqlite] how to update the Moving average value > > Keith Metcalf wrote: > > > >id  Sales

Re: [sqlite] how to update the Moving average value

2012-08-12 Thread Klaas V
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 >                      

Re: [sqlite] how to update the Moving average value

2012-08-11 Thread Keith Medcalf
s-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of ??? > Sent: Saturday, 11 August, 2012 22:46 > To: sqlite-users@sqlite.org > Subject: [sqlite] how to update the Moving average value > > I hace many record of product database,and wanna count th

[sqlite] how to update the Moving average value

2012-08-11 Thread 叶艳红
I hace many record of product database,and wanna count the moving average value of sales_vol of last 3 days(id) of value, how to write sql command? id Sales_vol mov_avg 1 1 2 2 3 3 =(1+2+3)/3 4 5 =(2+3+5)/3 5 4