Search Postgresql Archives

Re: PostgreSQL needs percentage function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Em 18/12/2017 15:01, David G. Johnston escreveu:
On Mon, Dec 18, 2017 at 9:56 AM, Edson Carlos Ericksson Richter <richter@xxxxxxxxxxxxxx> 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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux