Received: from mail.netgates.co.uk (mail.netgates.co.uk [194.105.64.74]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eARIOvt62127 for ; Mon, 27 Nov 2000 13:24:57 -0500 (EST) (envelope-from lists@a1.org.uk) Received: from a1.org.uk (martha.netgates.co.uk [194.105.64.211]) by mail.netgates.co.uk (Mirapoint) with ESMTP id BAO00488 (AUTH anthony); Mon, 27 Nov 2000 18:24:45 GMT Message-ID: <3A22A6ED.8A9D89B2@a1.org.uk> Date: Mon, 27 Nov 2000 18:24:45 +0000 From: Anthony X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: count( distinct x ) References: <3A229EBB.F55BA11@a1.org.uk> <1092.192.168.0.9.975348486.squirrel@mail.datascan-site.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/243 X-Sequence-Number: 274 Jose Rodrigo Fernandez Menegazzo wrote: > > The problem I have is with this statement: > > > > select count( distinct area ) from areapostcode where postcode like > > 'BS1%' > > > > the above statement fails with > > ERROR: parser: parse error at or near "distinct" > > > > I am not the greatest when it comes to SQL, but the pgsql docs implied > > that the above would work. > > > > What I am trying to do is get a count of the no of matches from the > > statement below > > select distinct area from areapostcode where postcode like 'BS1%' > > > > Not the count of: > > select area from areapostcode where postcode like 'BS1%' > > > > I don't have where to try it, but have you tried: > > select distinct count(area) from areapostcode where postcode like 'BS1%' > > Rodrigo F. yes, it responds as if distinct is not in the query string. Thanks, Bap.