From: Ulf Mehlig <umehlig@uni-bremen.de>
To: pgsql-sql@postgresql.org
Subject: "average" time
Date: Thu, 26 Oct 2000 17:24:27 +0200 (CEST)
Message-ID: <14840.19627.816771.43293@pandora3.vmnet.localnet> (raw)
Hello out there,
an ignorant's question: can I/how can I create an aggregate that
performs this operation on a group of timestamp values:
select some_column,
min(timest)+(max(timest)-min(timest))/2
from mytable
group by some_column;
that is, an aggregate which calculates the point half way between the
minimum and the maximum of the time series? I would like to use it
like this (substitute something appropriate for "median", I don't have
an idea how to call it):
select some_column, median(timest)
from mytable
group by some_column;
Any suggestions appreciated!
Regards,
Ulf
--
=======================================================================
Ulf Mehlig <ulf.mehlig@zmt.uni-bremen.de>
Center for Tropical Marine Ecology/ZMT, Bremen, Germany
-----------------------------------------------------------------------
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: umehlig@uni-bremen.de
Subject: Re: "average" time
In-Reply-To: <14840.19627.816771.43293@pandora3.vmnet.localnet>
References: <14840.19627.816771.43293@pandora3.vmnet.localnet>
* 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