Re: PostgreSQL needs percentage function

Поиск
Список
Период
Сортировка
От Edson Carlos Ericksson Richter
Тема Re: PostgreSQL needs percentage function
Дата
Msg-id a9885982-0939-c0c6-badc-32228b4874c3@simkorp.com.br
обсуждение исходный текст
Ответ на Re: PostgreSQL needs percentage function  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general

Em 18/12/2017 15:01, David G. Johnston escreveu:
On Mon, Dec 18, 2017 at 9:56 AM, Edson Carlos Ericksson Richter <richter@simkorp.com.br> wrote:
But, is it possible to have a aggregate function that calculates de percent from the sum (and/or count) total (as a value from 0 ... 1) for numeric (or double)?

​Do you mean:

SELECT id, val, val / (sum(val) OVER ())
FROM vals;​

​David J.​


I've never thought about Window Functions that way.
Thanks, it is enligthning.

:-)

Regards,

Edson.

В списке pgsql-general по дате отправления:

Предыдущее
От: Corey Taylor
Дата:
Сообщение: Re: PostgreSQL needs percentage function
Следующее
От: Rob Nikander
Дата:
Сообщение: reclaiming space from heavily used tables?