Re: count function alternative in postgres
От
Ben Morrow
Тема
Re: count function alternative in postgres
Дата
Msg-id
20100406184714.GA3290@osiris.mauzo.dyndns.org
Ответ на
count function alternative in postgres (junaidmalik14)
Список
Дерево обсуждения
count function alternative in postgres junaidmalik14 <junaidmalik14@gmail.com>
Re: count function alternative in postgres Ben Morrow <ben@morrow.me.uk>
Re: count function alternative in postgres junaidmalik14 <junaidmalik14@gmail.com>
Re: count function alternative in postgres Thomas Kellerer <spam_eater@gmx.net>
Re: count function alternative in postgres junaidmalik14 <junaidmalik14@gmail.com>
Quoth junaidmalik14@gmail.com (junaidmalik14): > > 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. Pg does support COUNT(DISTINCT ), but only for a single column. The best I can come up with for multiple columns is select count(distinct profile.tuple) from (select (id, name, age) as tuple from profile) as profile; or alternatively select count(*) from (select distinct (id, name, age) as tuple from profile) as profile; Ben
В списке pgsql-sql по дате отправления