Received: from mail-relay.trade-india.com (unknown [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 0B65147511A for ; Sat, 20 Apr 2002 13:20:31 -0400 (EDT) Received: (qmail 13953 invoked from network); 20 Apr 2002 17:25:28 -0000 Received: from system11.trade-india-local.com (HELO trade-india.com) (192.168.0.11) by ptil-236-129-del.primus-india.net with SMTP; 20 Apr 2002 17:25:28 -0000 Message-ID: <3CC1A42B.57D160B@trade-india.com> Date: Sat, 20 Apr 2002 22:53:55 +0530 From: Rajesh Kumar Mallah X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: Thorsten Wenzlaff Cc: pgsql Subject: Re: count different values in column? References: <006501c1e784$7f685d90$a57ba8c0@wxp> Content-Type: multipart/alternative; boundary="------------4E18CDC16573D6B076854408" X-Archive-Number: 200204/253 X-Sequence-Number: 7517 --------------4E18CDC16573D6B076854408 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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@postgresql.org) --------------4E18CDC16573D6B076854408 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit  

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@postgresql.org)

--------------4E18CDC16573D6B076854408--