pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PALAYRET Jacques <jacques.palayret@meteo.fr>
To: pgsql-general@lists.postgresql.org
Subject: Re: How do work tercile, percentile & funcion percentile_cont() ?
Date: Wed, 22 Apr 2020 10:15:26 +0200 (CEST)
Message-ID: <1475252183.38304209.1587543326347.JavaMail.zimbra@meteo.fr> (raw)
In-Reply-To: <1045753462.38287828.1587542449789.JavaMail.zimbra@meteo.fr>
References: <1045753462.38287828.1587542449789.JavaMail.zimbra@meteo.fr>

Of course, the same result with this table x(c1) for example : 
SELECT c1, ntile(3) OVER(ORDER BY c1) FROM x ORDER BY c1 ; 
c1 | ntile 
----+------- 
1 | 1 
2 | 1 
3 | 1 
4 | 1 
5 | 1 
6 | 1 
7 | 1 
8 | 1 
9 | 1 
10 | 1 
11 | 2 
11 | 2 
11 | 2 
11 | 2 
11 | 2 
11 | 2 
11 | 2 
11 | 2 
11 | 2 
20 | 2 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
21 | 3 
(30 lignes) 

SELECT percentile_cont(1./3) WITHIN GROUP (ORDER BY c1) FROM x ; 
percentile_cont 
------------------ 
10.6666666666667 
(1 ligne) 

SELECT percentile_cont(2./3) WITHIN GROUP (ORDER BY c1) FROM x ; 
percentile_cont 
------------------ 
20.3333333333333 
(1 ligne) 




De: "PALAYRET Jacques" <jacques.palayret@meteo.fr> 
À: pgsql-general@lists.postgresql.org 
Envoyé: Mercredi 22 Avril 2020 10:00:49 
Objet: How do work tercile, percentile & funcion percentile_cont() ? 

Hello, 

view thread (5+ messages)  latest in thread

Message-ID: <1475252183.38304209.1587543326347.JavaMail.zimbra@meteo.fr>
Permalink:  ../1475252183.38304209.1587543326347.JavaMail.zimbra@meteo.fr/
Also on:    postgresql.org/message-id/1475252183.38304209.1587543326347.JavaMail.zimbra@meteo.fr

 · 

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: jacques.palayret@meteo.fr
  Subject: Re: How do work tercile, percentile & funcion percentile_cont() ?
  In-Reply-To: <1475252183.38304209.1587543326347.JavaMail.zimbra@meteo.fr>
  References: <1045753462.38287828.1587542449789.JavaMail.zimbra@meteo.fr> <1475252183.38304209.1587543326347.JavaMail.zimbra@meteo.fr>

* 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