pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah@trade-india.com>
To: Thorsten Wenzlaff <thorsten.wenzlaff@gmx.de>
Cc: pgsql <pgsql-sql@postgresql.org>
Subject: Re: count different values in column?
Date: Sat, 20 Apr 2002 22:53:55 +0530
Message-ID: <3CC1A42B.57D160B@trade-india.com> (raw)
References: <006501c1e784$7f685d90$a57ba8c0@wxp>
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)
view thread (7+ messages)
Message-ID: <3CC1A42B.57D160B@trade-india.com> Permalink: ../3CC1A42B.57D160B@trade-india.com/ Also on: postgresql.org/message-id/3CC1A42B.57D160B@trade-india.com ·
reply
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: mallah@trade-india.com, thorsten.wenzlaff@gmx.de Subject: Re: count different values in column? In-Reply-To: <3CC1A42B.57D160B@trade-india.com> * 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