Hello,
while trying to implement an aggregate function "median", I am
facing two problems:
a) In order to compute the median, the input values of the aggregate
function need to come in ordered.
b) Computation of the statistical median requires *two* runs of
the aggregation: a simple count and a run until count/2 on the
ordered data.
Is it at all possible to implemnt such an aggregate function in PostgreSQL?
If yes, all suggestions are appreciated.
Thanks,
Christoph Dalitz