Re: count function alternative in postgres

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: junaid malik <junaidmalik14(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: count function alternative in postgres
Date: 2010-04-03 16:17:26
Message-ID: 20647.1270311446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

junaid malik <junaidmalik14(at)gmail(dot)com> writes:
> Is there any alternative of mysql function COUNT(DISTINCT expr,
> [expr...]) in postgres. We get error if we

The SQL-standard way to do that would be

select count(*) from (select distinct expr,expr,... from ...) as ss;

COUNT with multiple arguments is not anywhere in the standard.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message raghavendra t 2010-04-03 16:38:11 ERROR: cache lookup failed for relation X
Previous Message junaid malik 2010-04-03 13:34:19 count function alternative in postgres