pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: berger1517@gmx.ch
Cc: pgsql-sql@postgresql.org
Subject: Re: count different values in column
Date: Fri, 19 Apr 2002 11:46:48 METDST
Message-ID: <200204190946.LAA12543@rodos> (raw)
In-Reply-To: <007901c1e784$e3c21010$a57ba8c0@wxp>

select max(count) from (
select a, count(a) from Resulttable group by a 
) as foo; 
 max
-----
   3
(1 row)
should do it. 
Regards, Christoph 

> Hello,
> today I have a new question :)
> 
> I've a resulttable is generated by a couple of subselects and joins which
> contains only one column.
> 
> Now I want to count the different values in the column.
> 
> Resulttable :
>    a
> ------
> 10
> 12
> 12
> 12
> 14
> 14
> 15
> 
> I need the value which is repeated most in the resulttable (in this example
> 12 ) !
> 
> 
> Any suggestions ?
> 
> 
> Thx
> berger
> 



view thread (7+ messages)  latest in thread

Message-ID: <200204190946.LAA12543@rodos>
Permalink:  ../200204190946.LAA12543@rodos/
Also on:    postgresql.org/message-id/200204190946.LAA12543@rodos

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, berger1517@gmx.ch
  Subject: Re: count different values in column
  In-Reply-To: <200204190946.LAA12543@rodos>

* 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