Re: counting distinct rows on more than one column - Mailing list pgsql-sql

From Tom Lane
Subject Re: counting distinct rows on more than one column
Date
Msg-id 18315.985795851@sss.pgh.pa.us
Whole thread Raw
In response to counting distinct rows on more than one column  (Dirk Lutzebaeck <lutzeb@aeccom.com>)
List pgsql-sql
Dirk Lutzebaeck <lutzeb@aeccom.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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: DELETE FROM fails with error
Next
From: "Douglas Brunton"
Date:
Subject: Oracle -> Postgresql migration