Received: from thor.tht.net (thor.tht.net [209.47.145.4]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eARL4Pt75521 for ; Mon, 27 Nov 2000 16:04:25 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by thor.tht.net (8.9.3/8.9.3) with ESMTP id RAA51312 for ; Mon, 27 Nov 2000 17:05:37 GMT (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id eARKxXw12321; Mon, 27 Nov 2000 15:59:33 -0500 (EST) To: Anthony cc: pgsql-sql@postgresql.org Subject: Re: count( distinct x ) In-reply-to: <3A22B6F7.50E8C122@a1.org.uk> References: <3A22B6F7.50E8C122@a1.org.uk> Comments: In-reply-to Anthony message dated "Mon, 27 Nov 2000 19:33:11 +0000" Date: Mon, 27 Nov 2000 15:59:33 -0500 Message-ID: <12318.975358773@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200011/256 X-Sequence-Number: 287 Anthony 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