Re: [SQL] Need magic for a moving statistic

2009-10-02 Thread Andreas
A. Kretschmer schrieb: [...] Or simpler: test=*# select ((d-'2009-10-02'::date)/14) || '. period' as period, sum(value) from foo group by 1; This is tricky, because you use a text-column to sort but need numerical sorting since there will be more than 0-9 periods. This is still the way

Re: [SQL] Need magic for a moving statistic

2009-10-02 Thread A. Kretschmer
In response to Andreas : > > A. Kretschmer schrieb: > >[...] Or simpler: > > > >test=*# select ((d-'2009-10-02'::date)/14) || '. period' as period, > >sum(value) from foo group by 1; > > > This is tricky, because you use a text-column to sort but need numerical > sorting since there will be m