Обсуждение: How to obtain a coalesce aggregation in a GROUP BY query?

Поиск
Список
Период
Сортировка

How to obtain a coalesce aggregation in a GROUP BY query?

От
Federico Dal Maso
Дата:
I need write a query like this

select coalesce_agg(col order by col asc) from some_table group by other_col

clearly the col column is nullable.
which is the best way (in terms of performance too) to obtain this?

Are there any built-in aggregate function or should I write a new aggregate function with CREATE AGGREGATE?
Do you think coalesce_agg should be a built-in aggregation?

Thanks in advance

--
Federico Dal Maso