pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: Nick Dro <postgresql@walla.co.il>
Cc: pgsql-general@postgresql.org
Subject: Re: PostgreSQL needs percentage function
Date: Mon, 18 Dec 2017 16:44:49 +0100
Message-ID: <20171218154449.GA19797@depesz.com> (raw)
In-Reply-To: <^75EF6A639D2C0E83BEC677FB95E668672BBAB816@walla.co.il>
References: <^75EF6A639D2C0E83BEC677FB95E668672BBAB816@walla.co.il>

On Mon, Dec 18, 2017 at 02:23:38PM +0200, Nick Dro wrote:
>    Hi,
>    Why PostgreSQL doesn't have build-in function to calculate percentage?
>    somthing like percent(number,%
>    for example:
>    select percent(100,1) will calculate 1% of 100 = 1
>    select percent(25,20) will calculate 20% of 25 = 5

What is the problem with using normal multiplication for this?

depesz




view thread (19+ messages)  latest in thread

Message-ID: <20171218154449.GA19797@depesz.com>
Permalink:  ../20171218154449.GA19797@depesz.com/
Also on:    postgresql.org/message-id/20171218154449.GA19797@depesz.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: depesz@depesz.com, postgresql@walla.co.il
  Subject: Re: PostgreSQL needs percentage function
  In-Reply-To: <20171218154449.GA19797@depesz.com>
  References: <^75EF6A639D2C0E83BEC677FB95E668672BBAB816@walla.co.il> <20171218154449.GA19797@depesz.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox