Received: from itplrelay.in.tatainfotech.com (unknown [203.200.59.46]) by postgresql.org (Postfix) with ESMTP id 60A5847510B for ; Fri, 19 Apr 2002 05:43:25 -0400 (EDT) Received: from blrmail.in.tatainfotech.com (IDENT:root@itplrelay.tatainfotech.com [127.0.0.1]) by itplrelay.in.tatainfotech.com (8.11.0/8.11.0) with ESMTP id g3J9io330746; Fri, 19 Apr 2002 15:14:51 +0530 Received: from dsspntw34 ([163.122.5.65]) by blrmail.in.tatainfotech.com (8.9.3/8.9.3) with SMTP id PAA10501; Fri, 19 Apr 2002 15:16:14 +0530 Message-ID: <00db01c1e789$1a5294c0$41057aa3@tatainfotech.com> From: "Gautham S. Rao" To: "Albrecht Berger" , "pgsql" References: <007901c1e784$e3c21010$a57ba8c0@wxp> Subject: Re: count different values in column Date: Fri, 19 Apr 2002 15:30:56 +0530 Organization: Tata Infotech Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Archive-Number: 200204/240 X-Sequence-Number: 7504 Hi Berger, Try, select a from Resulttable group by a having count(a) = (select max(cnt) from (select count(a) as cnt from Resulttable group by a) as tmp); Regards, Gautham. ----- Original Message ----- From: "Albrecht Berger" To: "pgsql" Sent: Friday, April 19, 2002 3:00 PM Subject: [SQL] count different values in column > 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 4: Don't 'kill -9' the postmaster >