Received: from mail.india-today.com ([203.122.21.204]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eBQ6NcL03060 for ; Tue, 26 Dec 2000 01:23:38 -0500 (EST) (envelope-from anand@mail.india-today.com) Received: (qmail 1476 invoked by uid 500); 26 Dec 2000 06:43:44 -0000 Date: Tue, 26 Dec 2000 12:13:43 +0530 From: Anand Raman To: pgsql-general@postgresql.org Subject: Re: COUNT(Distinct city) HELP!!! Message-ID: <20001226121343.A683@india-today.com> Mail-Followup-To: pgsql-general@postgresql.org References: <001001c06ec8$36bec380$6500a8c0@win2k> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from sszabo@megazone23.bigpanda.com on Mon, Dec 25, 2000 at 05:27:30PM -0800 75Uptime: 11:19am up 10 min, 2 users, load average: 0.03, 0.19, 0.16 X-Archive-Number: 200012/709 X-Sequence-Number: 1993 or u can also try select count(*) from (select distinct city from ct); Hope this helps Anand On Mon, Dec 25, 2000 at 05:27:30PM -0800, Stephan Szabo wrote: > >I believe that functionality was added in version 7.0, >are you using an earlier version? > >On Mon, 25 Dec 2000, Abe wrote: > >> Hey there, >> >> I get this error but I think this is supposed to work: >> >> The table has some duplicates such as Munich I want the number of distinct cities: >> >> abenew=> select * from ct; >> name| age| city >> ---- +--- +------ >> jow | 10| london >> tim | 15| paris >> kim | 17| munich >> te | 19| munich >> (8 rows) >> >> My query is as follows: >> >> tester => select count(distinct city) from ct; >> ERROR: parser: parse error at or near "distinct" >> >> Any guidance would be appreciated... >> Thanks >> Abe >>