Received: from glass.toledolink.com (glass.toledolink.com [205.133.127.8]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2SGCpU35505 for ; Wed, 28 Mar 2001 11:12:51 -0500 (EST) (envelope-from mfork@toledolink.com) Received: from localhost (mfork@localhost) by glass.toledolink.com (8.10.2/8.10.2) with ESMTP id f2SGCk612640; Wed, 28 Mar 2001 11:12:47 -0500 (EST) Date: Wed, 28 Mar 2001 11:12:42 -0500 (EST) From: Michael Fork To: Dirk Lutzebaeck cc: pgsql-sql@postgresql.org Subject: Re: counting distinct rows on more than one column In-Reply-To: <15041.65308.150764.131312@ampato.core.aeccom.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200103/580 X-Sequence-Number: 2250 In 7.0.3, I believe the following would work: SELECT count(distinct(a || b)) FROM t; if subselects in from were supported in 7.0.3 as they are in 7.1, you could do: SELECT count(*) FROM (SELECT DISTINCT a,b FROM t) FROM x Michael Fork - CCNA - MCP - A+ Network Support - Toledo Internet Access - Toledo Ohio On Wed, 28 Mar 2001, Dirk Lutzebaeck wrote: > > 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 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >