From: Tod McQuillin <devin@spamcop.net>
To: Albrecht Berger <berger1517@gmx.ch>
Cc: pgsql <pgsql-sql@postgresql.org>
Subject: Re: count different values in column
Date: Fri, 19 Apr 2002 04:40:35 -0500 (CDT)
Message-ID: <Pine.GSO.4.44.0204190439100.5488-100000@sysadmin> (raw)
In-Reply-To: <007901c1e784$e3c21010$a57ba8c0@wxp>
On Fri, 19 Apr 2002, Albrecht Berger wrote:
> 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 ) !
SELECT a, count(a) FROM resulttable GROUP BY a ORDER BY 2 DESC
--
Tod McQuillin
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: devin@spamcop.net, berger1517@gmx.ch
Subject: Re: count different values in column
In-Reply-To: <Pine.GSO.4.44.0204190439100.5488-100000@sysadmin>
* 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