counting groups

Поиск
Список
Период
Сортировка
От Holger Klawitter
Тема counting groups
Дата
Msg-id 39F56E52.C65F5978@klawitter.de
обсуждение исходный текст
Ответы Re: counting groups  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi there,

is there any way to count groups in Postgres ? The following
(simplified) statement should return the number of attributes
which come up more than once.

SELECT count(distinct attr)
FROM table
WHERE condition
GROUP BY attr
HAVING count(*)>1

But it returns just the right number of 1's.
There must be a nicer way than selection INTO a temporary table
and counting from there ...

Regards,
Mit freundlichem Gruß,
    Holger Klawitter
--
Holger Klawitter                                    +49 (0)251 484 0637
holger@klawitter.de                            http://www.klawitter.de/

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

Предыдущее
От: Gilles DAROLD
Дата:
Сообщение: PL/Perl compilation error
Следующее
От: Holger Klawitter
Дата:
Сообщение: Re: counting groups