Received: from nezu.gs.verio.net (nezu.gs.verio.net [204.27.65.34]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2SKhYU84248 for ; Wed, 28 Mar 2001 15:43:34 -0500 (EST) (envelope-from jeckermann@verio.net) Received: by NEZU with Internet Mail Service (5.5.2650.21) id ; Wed, 28 Mar 2001 14:43:27 -0600 Message-ID: <08CD1781F85AD4118E0800A0C9B8580B0949E1@NEZU> From: Jeff Eckermann To: "'Dirk Lutzebaeck'" , Michael Fork Cc: pgsql-sql@postgresql.org Subject: RE: counting distinct rows on more than one column Date: Wed, 28 Mar 2001 14:43:26 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain X-Archive-Number: 200103/590 X-Sequence-Number: 2260 I don't think this will necessarily work: field1 | field2 aa | ab a | aab These are two distinct rows, so should be counted as two. The proposed method would count them as one. You can get around this problem by doing: count (distinct (a || x || b)) where x is some character not found in your data. > -----Original Message----- > From: Dirk Lutzebaeck [SMTP:lutzeb@aeccom.com] > Sent: Wednesday, March 28, 2001 1:32 PM > To: Michael Fork > Cc: pgsql-sql@postgresql.org > Subject: Re: counting distinct rows on more than one column > > Michael Fork writes: > > In 7.0.3, I believe the following would work: > > > > SELECT count(distinct(a || b)) FROM t; > > Great, this works! I don't quite get it why... > > Dirk > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly