Re: PostgreSQL needs percentage function

Поиск
Список
Период
Сортировка
От Corey Taylor
Тема Re: PostgreSQL needs percentage function
Дата
Msg-id CADBz385ZUfOUN18aVUf9P-TxXW2o_gZWGJ=Wyf=8ytiz-_SP1Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL needs percentage function  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On Mon, Dec 18, 2017 at 11:01 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
​Do you mean:

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


You could end up with a percentage > 100 or divide by 0 with that if the values are not in a proper range.  I don't know if that would be the intention.

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: PostgreSQL needs percentage function
Следующее
От: Edson Carlos Ericksson Richter
Дата:
Сообщение: Re: PostgreSQL needs percentage function