Re: PostgreSQL needs percentage function - Mailing list pgsql-general

From Corey Taylor
Subject Re: PostgreSQL needs percentage function
Date
Msg-id CADBz385ZUfOUN18aVUf9P-TxXW2o_gZWGJ=Wyf=8ytiz-_SP1Q@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL needs percentage function  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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 by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: PostgreSQL needs percentage function
Next
From: Edson Carlos Ericksson Richter
Date:
Subject: Re: PostgreSQL needs percentage function