count different values in column?
count different values in column?
От:
"Thorsten Wenzlaff" <thorsten.wenzlaff@gmx.de>
Дата:
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
Re: count different values in column?
От:
Rajesh Kumar Mallah <mallah@trade-india.com>
Дата:
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
15I 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)