Re: count different values in column?

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: Thorsten Wenzlaff <thorsten(dot)wenzlaff(at)gmx(dot)de>
Cc: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: count different values in column?
Date: 2002-04-20 17:23:55
Message-ID: 3CC1A42B.57D160B@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Does the below solve your problem ?

SELECT a from resulttable group by a order by count(a) desc limit 1;
a
----
12
(1 row)

regds
mallah

Thorsten Wenzlaff wrote:

> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2002-04-20 19:00:37 OpenFTS/tsearch and Postgresql 7.2.1
Previous Message tulasi 2002-04-20 07:01:37 accept AD35- 6FA9 -9515