Re: count( distinct x )

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Anthony <lists(at)a1(dot)org(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: count( distinct x )
Date: 2000-11-27 20:59:33
Message-ID: 12318.975358773@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Anthony <lists(at)a1(dot)org(dot)uk> writes:
> I think it's time to get Mr. Sysadmin to upgrade to v7 ;)

That's a good idea on many grounds, not only this one ;-)

However, if you really need a 6.5.* solution, you could do

SELECT DISTINCT foo INTO TEMP TABLE mytemp FROM ...
SELECT COUNT(*) FROM mytemp;
DROP TABLE mytemp;

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Poul L. Christiansen 2000-11-27 21:44:39 Re: [SQL] a script that queries database periodically
Previous Message Serge Canizares 2000-11-27 20:31:55 Re: a script that queries database periodically