Aggregate Function to return most common value for a column

Поиск
Список
Период
Сортировка
От Michael Harris
Тема Aggregate Function to return most common value for a column
Дата
Msg-id E5F4C5A18CAB7A4DA23080DE9CE815860834FC61@eaubrmw001.eapac.ericsson.se
обсуждение исходный текст
Ответы Re: Aggregate Function to return most common value for a column  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Aggregate Function to return most common value for a column  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Re: Aggregate Function to return most common value for a column  (artacus@comcast.net)
Список pgsql-general
Hi Experts,

I want to use an aggregate function that will return the most commonly
occurring value in a column.

The column consists of VARCHAR(32) values.

Is it possible to construct such an aggregate using PL/PgSql ?

If I was trying to do something like this in Perl I would use a hash
table to store the values and the number of times each was seen as the
table was iterated, but PL/PgSql does not seem to have an appropriate
data type for that?

I don't want to use PL/Perl to avoid the overhead of starting a perl
interpreter for that.

Do I have to write the function in C maybe?


Thanks in advance,
Regards
Mike Harris


В списке pgsql-general по дате отправления:

Предыдущее
От: Tommy Gildseth
Дата:
Сообщение: Re: How to restore a SQL-ASCII encoded database to a new UTF-8 db?
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Aggregate Function to return most common value for a column