Re: PostgreSQL needs percentage function

From: Corey Taylor <corey(dot)taylor(dot)fl(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Edson Carlos Ericksson Richter <richter(at)simkorp(dot)com(dot)br>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL needs percentage function
Date: 2017-12-18 17:07:40
Message-ID: CADBz385ZUfOUN18aVUf9P-TxXW2o_gZWGJ=Wyf=8ytiz-_SP1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 18, 2017 at 11:01 AM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Edson Carlos Ericksson Richter 2017-12-18 17:08:14 Re: PostgreSQL needs percentage function
Previous Message David G. Johnston 2017-12-18 17:01:19 Re: PostgreSQL needs percentage function