using 'count' to show number of dupes

Поиск
Список
Период
Сортировка
От Andy Harrison
Тема using 'count' to show number of dupes
Дата
Msg-id a22ff29404071210285ffff333@mail.gmail.com
обсуждение исходный текст
Ответы Re: using 'count' to show number of dupes  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-novice
I'm writing some perl to sendmail maillog reporting.  Since the logs
are too big to some of the things I want to do, I'm just stuffing it
to a pgsql db.  I'd like to offload as much of the work onto the db as
much as possible.

How can I use count to show rows with the same value in the column?

col1   col2   col3
foo1   bar1   baz1
foo2   bar1   baz2
foo3   bar2   baz3
foo4   bar3   baz4
foo5   bar1   baz5
foo6   bar2   baz6


So, what would get pg to show me that col2 has 3 'bar1' values, 2
'bar2' values and 1 'bar1' value.

--
Andy Harrison

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

Предыдущее
От: David.Ventimiglia@wellsfargo.com
Дата:
Сообщение: FW: table inheritance and polymorphic functions
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: using 'count' to show number of dupes