Search Postgresql Archives

Aggregate Function to return most common value for a column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux