Thread: "average" time

"average" time

From
Ulf Mehlig
Date:
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
 
-----------------------------------------------------------------------