pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: Need magic for a moving statistic
Date: Fri, 2 Oct 2009 15:10:36 +0200
Message-ID: <20091002131036.GA25746@a-kretschmer.de> (raw)
In-Reply-To: <4AC5F647.8030204@gmx.net>
References: <4AC55231.2080008@gmx.net>
	<20091002052916.GA22496@a-kretschmer.de>
	<4AC5F647.8030204@gmx.net>

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)



view thread (4+ messages)

Message-ID: <20091002131036.GA25746@a-kretschmer.de>
Permalink:  ../20091002131036.GA25746@a-kretschmer.de/
Also on:    postgresql.org/message-id/20091002131036.GA25746@a-kretschmer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andreas.kretschmer@schollglas.com
  Subject: Re: Need magic for a moving statistic
  In-Reply-To: <20091002131036.GA25746@a-kretschmer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox