0

I want to create an aggregate function that takes in a column (list of values) as opposed to a single value.

The end-goal is to create a function MEDIAN that I can use just like AVG, MAX, etc, exmaple:

select MEDIAN(data.val) mdn from data where created_at > "..." group by kind order by mdn desc;

I would like the function to simply implement the logic in https://stackoverflow.com/a/7263925/3000014.

Looking at docs, it seems the input should be a single value, and not a column (list of values).

Is it possible to achieve this?

bkr879
  • 1,885
  • 2
  • 12
  • 19

0 Answers0