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

From David G. Johnston
Subject Re: PostgreSQL needs percentage function
Date
Msg-id CAKFQuwa_K2yMB+O0-xJHzKG6tsbcakwK1zf+qLcACgBs1ayFhQ@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL needs percentage function  (Edson Carlos Ericksson Richter <richter@simkorp.com.br>)
Responses Re: PostgreSQL needs percentage function
Re: PostgreSQL needs percentage function
List pgsql-general
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.​

pgsql-general by date:

Previous
From: Edson Carlos Ericksson Richter
Date:
Subject: Re: PostgreSQL needs percentage function
Next
From: Corey Taylor
Date:
Subject: Re: PostgreSQL needs percentage function