"average" time - Mailing list pgsql-sql

From Ulf Mehlig
Subject "average" time
Date
Msg-id 14840.19627.816771.43293@pandora3.vmnet.localnet
Whole thread Raw
List pgsql-sql
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
 
-----------------------------------------------------------------------


pgsql-sql by date:

Previous
From: Sandis Jerics
Date:
Subject: HELP! ... pg_locale ???
Next
From: "Pitot"
Date:
Subject: Nested Aggregate fonction & gouping attributes