Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D55A463285A for ; Fri, 2 Oct 2009 10:10:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 61709-09 for ; Fri, 2 Oct 2009 13:10:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mail.postgresql.org (Postfix) with ESMTP id F38796323C0 for ; Fri, 2 Oct 2009 10:10:40 -0300 (ADT) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MZ7a0-1Md8QD11UC-00KyyO; Fri, 02 Oct 2009 15:10:38 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1Mthu8-0006nZ-00 for pgsql-sql@postgresql.org; Fri, 02 Oct 2009 15:10:36 +0200 Date: Fri, 2 Oct 2009 15:10:36 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: Need magic for a moving statistic Message-ID: <20091002131036.GA25746@a-kretschmer.de> References: <4AC55231.2080008@gmx.net> <20091002052916.GA22496@a-kretschmer.de> <4AC5F647.8030204@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AC5F647.8030204@gmx.net> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX18BYAZO/C/psQ9HhWqnzujDSFDL7fvX5qQA8B7 JMLPmm5DXg6NpfMLKnDyhz+cIIV9KwQhyWYqh4QiDjgJ+usy23 yB7eYxvY+R3+/pQN35moQ== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 200910/14 X-Sequence-Number: 33213 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)