Re: count different values in column

From: Tod McQuillin <devin(at)spamcop(dot)net>
To: Albrecht Berger <berger1517(at)gmx(dot)ch>
Cc: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: count different values in column
Date: 2002-04-19 09:40:35
Message-ID: Pine.GSO.4.44.0204190439100.5488-100000@sysadmin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Fduch the Pravking 2002-04-19 09:55:02 Re: count different values in column
Previous Message Albrecht Berger 2002-04-19 09:30:47 count different values in column