More aggregate functions?
От | David Garamond |
---|---|
Тема | More aggregate functions? |
Дата | |
Msg-id | 4073B7DC.7090302@zara.6.isreserved.com обсуждение исходный текст |
Ответы |
Re: More aggregate functions?
Re: More aggregate functions? |
Список | pgsql-general |
What do people think of adding some more aggregate functions. These are the ones that MySQL has and PG doesn't: - STD/STDDEV - VARIANCE - BIT_OR - BIT_AND - GROUP_CONCAT (for strings, added in MySQL 4.x) Particularly, I find GROUP_CONCAT practical to quickly display 1-many relationship, e.g.: CREATE TABLE mommy ( id INT PRIMARY KEY, name TEXT); CREATE TABLE child ( id INT PRIMARY KEY, mommy_id INT REFERENCES(mommy(id)), name TEXT ); SELECT mommy.name as mommy, GROUP_CONCAT(child.name SEPARATOR ", ") as children FROM mommy, child GROUP BY mommy.id; would result in: mommy children ----- ----------------- dot ellen, catherine cate bridget, kerry, rory rachel emma Btw, I have written 1 or 2 of the above myself with CREATE AGGREGATE. But perhaps it would be nice if it's available as a builtin function or at least present in contrib/. -- dave
В списке pgsql-general по дате отправления: