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 eARIwTt65698 for ; Mon, 27 Nov 2000 13:58:30 -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 BAO00713 (AUTH anthony); Mon, 27 Nov 2000 18:58:40 GMT Message-ID: <3A22AEE0.4FD68ECF@a1.org.uk> Date: Mon, 27 Nov 2000 18:58:40 +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: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/245 X-Sequence-Number: 276 Michael Fork wrote: > I think you want > > SELECT count(distinct(area)) FROM areapostcode WHERE postcode LIKE 'BS1%' > psql still not happy :( SELECT count(distinct(area)) FROM areapostcode WHERE postcode LIKE 'BS1%'; ERROR: parser: parse error at or near "distinct" Thanks, Bap. > > Michael Fork - CCNA - MCP - A+ > Network Support - Toledo Internet Access - Toledo Ohio > > On Mon, 27 Nov 2000, Anthony wrote: > > > Apologies if this has been asked b4, but got this result when > > attemplting to search the archives on the website > > > > Not Found > > > > The requested URL /mhonarc/pgsql-sql/search.cgi was not found on this > > server. > > > > > > Apache/1.3.12 Server at postgresql.rmplc.co.uk Port 80 > > > > 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%' > > > > Can anyone help? > > > > TIA > > Bap. > >