Re: count function alternative in postgres

Поиск
Список
Период
Сортировка
От Scott Bailey
Тема Re: count function alternative in postgres
Дата
Msg-id 4BB790AB.6000904@comcast.net
обсуждение исходный текст
Ответ на count function alternative in postgres  (junaid malik <junaidmalik14@gmail.com>)
Ответы Re: count function alternative in postgres  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
junaid malik wrote:
> Is there any alternative of mysql function COUNT(DISTINCT expr,
> [expr...]) in postgres. We get error if we
>
> write count like this count(distinct profile.id, profile.name,
> profile.age) but it works well in mysql.
>
> Reference url is given below
>
> http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_count-distinct
>
> Thanks
>

I already answered your question on dbforums.com. But in Postgres you
can do:

SELECT COUNT( DISTINCT row(col1, col2, col3) ) FROM foo
or
SELECT COUNT( DISTINCT (col1, col2, col3) ) FROM foo

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ERROR: cache lookup failed for relation X
Следующее
От: Scott Bailey
Дата:
Сообщение: Re: any built-in function to get time in seconds?