Re: counting distinct rows on more than one column

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: counting distinct rows on more than one column
Date: 2001-03-28 16:10:51
Message-ID: 18315.985795851@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com> writes:
> on 7.0.3 want to COUNT
> SELECT DISTINCT a,b FROM t;

In 7.1 you could do

select count(*) from (select distinct a,b from t) as t1;

In 7.0 and before I think you have no choice but to use a temp table.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fork 2001-03-28 16:12:42 Re: counting distinct rows on more than one column
Previous Message Michael Ansley 2001-03-28 15:58:13 RE: counting distinct rows on more than one column