Re: Need magic for a moving statistic

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Need magic for a moving statistic
Date: 2009-10-02 13:10:36
Message-ID: 20091002131036.GA25746@a-kretschmer.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 more than 0-9 periods.

Yes, sure. Use ((d-'2009-10-02'::date)/14) instead for order. My fault.

>
> This is still the way to handle the periodity without pulling out some
> external skript language.
> Thanks for the reply. :)

Glad to help you ;-)
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas 2009-10-04 04:08:18 Need even more magic. Now for tricky counts.
Previous Message Andreas 2009-10-02 12:47:03 Re: Need magic for a moving statistic