Received: from k3.core.aeccom.com (gate2.aeccom.com [195.211.178.194]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2SFC6U05416 for ; Wed, 28 Mar 2001 10:12:08 -0500 (EST) (envelope-from lutzeb@aeccom.com) Received: from ampato.core.aeccom.com (IDENT:root@ampato.core.aeccom.com [192.168.2.11]) by k3.core.aeccom.com (8.9.3/8.9.3) with ESMTP id RAA11076; Wed, 28 Mar 2001 17:12:04 +0200 Received: (from lutzeb@localhost) by ampato.core.aeccom.com (8.9.3/8.9.3) id RAA01958; Wed, 28 Mar 2001 17:12:04 +0200 From: Dirk Lutzebaeck MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15041.65308.150764.131312@ampato.core.aeccom.com> Date: Wed, 28 Mar 2001 17:11:24 +0200 (CEST) To: pgsql-sql@postgresql.org Subject: counting distinct rows on more than one column X-Mailer: VM 6.72 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid X-Archive-Number: 200103/577 X-Sequence-Number: 2247 Hi, on 7.0.3 want to COUNT SELECT DISTINCT a,b FROM t; I can't find a solution because any combination with count with more than one column gives syntax errors. One solution would be to set a view: CREATE VIEW v AS SELECT DISTINCT a,b FROM t; and then SELECT count(a) FROM v but views don't support distinct in v7.0.3 Ok I could use a temporary table but my select distinct tends to give large results. Any clues? Dirk