From abe@fish.tm Mon Dec 25 23:12:50 2000 Received: from smtp-relay.noc.dsvr.net (smtp-relay.noc.dsvr.net [212.69.192.4]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBPN5HL79440; Mon, 25 Dec 2000 18:05:17 -0500 (EST) (envelope-from abe@fish.tm) Received: from [212.69.192.199] (helo=fish.serve.co.uk) by smtp-relay.noc.dsvr.net with esmtp (Exim 3.16 #1) id 14AggT-0000VQ-00; Mon, 25 Dec 2000 23:05:37 +0000 Received: from win2k (host213-122-205-40.btinternet.com [213.122.205.40] (may be forged)) by fish.serve.co.uk (8.9.3/8.9.3) with SMTP id XAA01759; Mon, 25 Dec 2000 23:05:30 GMT Message-ID: <001001c06ec8$36bec380$6500a8c0@win2k> From: "Abe" To: "PostgreSQL Hackers List" , Subject: COUNT(Distinct city) HELP!!! Date: Mon, 25 Dec 2000 23:12:50 -0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000D_01C06EC8.336A1A40" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200012/706 X-Sequence-Number: 1990 This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C06EC8.336A1A40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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=3D> 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 =3D> select count(distinct city) from ct; ERROR: parser: parse error at or near "distinct" Any guidance would be appreciated... Thanks Abe ------=_NextPart_000_000D_01C06EC8.336A1A40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hey there,
 
I get this error but I think this is suppo= sed to=20 work:
 
The table has some duplicates such as = ;Munich I=20 want the number of distinct cities:
 
abenew=3D> select * from ct;
name|    age|   =20 city
----       =20 +---      +------
jow  |=20     10|     london
tim |=20      15|     paris
kim |=20     17|     munich
te  =20 |      19|     munich
= (8=20 rows)
 
My query is as follows:
 
tester =3D> select count(distinct city)= from=20 ct;
ERROR:  parser: parse error at or near "distinct"
 
Any guidance would be appreciated...
Thanks
Abe
------=_NextPart_000_000D_01C06EC8.336A1A40-- From markw@mohawksoft.com Mon Dec 25 23:23:19 2000 Received: from snoopy.mohawksoft.com ([216.41.12.227]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBPNKML80645 for ; Mon, 25 Dec 2000 18:20:22 -0500 (EST) (envelope-from markw@mohawksoft.com) Received: from mohawksoft.com (IDENT:markw@snoopy.mohawksoft.com [216.41.12.227]) by snoopy.mohawksoft.com (8.11.0/8.11.0) with ESMTP id eBPNNJF14053; Mon, 25 Dec 2000 18:23:19 -0500 Message-ID: <3A47D6E7.E85FACDE@mohawksoft.com> Date: Mon, 25 Dec 2000 18:23:19 -0500 From: mlw X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-Mohawk i686) X-Accept-Language: en MIME-Version: 1.0 To: Abe , Hackers List Subject: Re: COUNT(Distinct city) HELP!!! References: <001001c06ec8$36bec380$6500a8c0@win2k> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200012/988 X-Sequence-Number: 2517 Abe wrote: > > Part 1.1 Type: Plain Text (text/plain) > Encoding: quoted-printable Try this: select count(distinct (city) ) from ct -- http://www.mohawksoft.com From sszabo@megazone23.bigpanda.com Tue Dec 26 01:27:30 2000 Received: from megazone23.bigpanda.com (rfx-64-6-210-138.users.reflexcom.com [64.6.210.138]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBQ1RfL89772; Mon, 25 Dec 2000 20:27:41 -0500 (EST) (envelope-from sszabo@megazone23.bigpanda.com) Received: from localhost (sszabo@localhost) by megazone23.bigpanda.com (8.11.1/8.11.1) with ESMTP id eBQ1RUO03775; Mon, 25 Dec 2000 17:27:30 -0800 (PST) Date: Mon, 25 Dec 2000 17:27:30 -0800 (PST) From: Stephan Szabo To: Abe cc: PostgreSQL Hackers List , pgsql-general@postgresql.org Subject: Re: COUNT(Distinct city) HELP!!! In-Reply-To: <001001c06ec8$36bec380$6500a8c0@win2k> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200012/707 X-Sequence-Number: 1991 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 > From grasshacker@over-yonder.net Tue Dec 26 02:08:24 2000 Received: from draco.over-yonder.net (mortis.sighup.org [63.147.13.14] (may be forged)) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBQ281L91819 for ; Mon, 25 Dec 2000 21:08:01 -0500 (EST) (envelope-from gh@over-yonder.net) Received: by draco.over-yonder.net (Postfix, from userid 1012) id 76E3162D07; Mon, 25 Dec 2000 20:08:24 -0600 (CST) Date: Mon, 25 Dec 2000 20:08:24 -0600 From: GH To: Abe Cc: pgsql-general@postgresql.org Subject: Re: COUNT(Distinct city) HELP!!! Message-ID: <20001225200824.A30984@over-yonder.net> 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: <001001c06ec8$36bec380$6500a8c0@win2k>; from abe@fish.tm on Mon, Dec 25, 2000 at 11:12:50PM -0000 X-OS: FreeBSD X-Archive-Number: 200012/708 X-Sequence-Number: 1992 On Mon, Dec 25, 2000 at 11:12:50PM -0000, some SMTP stream spewed forth: > Hey there, > > I get this error but I think this is supposed to work: Hrm, it works here on 7.0.2 where each field is "text". => select version(); version ----------------------------------------------------------------- PostgreSQL 7.0.2 on i386-unknown-freebsdelf4.0, compiled by cc (1 row) I wish that I could actually *help* you, but I can not. ;-( G'luck. gh > > 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 From markw@mohawksoft.com Tue Dec 26 02:39:47 2000 Received: from snoopy.mohawksoft.com ([216.41.12.227]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBQ2afL93041 for ; Mon, 25 Dec 2000 21:36:41 -0500 (EST) (envelope-from markw@mohawksoft.com) Received: from mohawksoft.com (IDENT:markw@snoopy.mohawksoft.com [216.41.12.227]) by snoopy.mohawksoft.com (8.11.0/8.11.0) with ESMTP id eBQ2dlF14563; Mon, 25 Dec 2000 21:39:47 -0500 Message-ID: <3A4804F3.F61D0C48@mohawksoft.com> Date: Mon, 25 Dec 2000 21:39:47 -0500 From: mlw X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-Mohawk i686) X-Accept-Language: en MIME-Version: 1.0 To: Abe CC: Hackers List Subject: Re: COUNT(Distinct city) HELP!!! References: <001001c06ec8$36bec380$6500a8c0@win2k> <3A47D6E7.E85FACDE@mohawksoft.com> <002e01c06ee5$6abe5ac0$6500a8c0@win2k> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200012/993 X-Sequence-Number: 2522 Abe wrote: > > Hey there, > > Just tried that - No luck - I am using version 6.5.0 - Maybe its just not > available in this version. > Any alternatives ? I have tried this on version 7.02. I assume 6.5 did not support it. > > Thanks Guys, > Abe > ----- Original Message ----- > From: "mlw" > To: "Abe" ; "Hackers List" > Sent: Monday, December 25, 2000 11:23 PM > Subject: Re: COUNT(Distinct city) HELP!!! > > > Abe wrote: > > > > > > Part 1.1 Type: Plain Text (text/plain) > > > Encoding: quoted-printable > > > > Try this: > > select count(distinct (city) ) from ct > > -- > > http://www.mohawksoft.com > > -- http://www.mohawksoft.com From abe@fish.tm Tue Dec 26 02:41:56 2000 Received: from cmailg7.svr.pol.co.uk (cmailg7.svr.pol.co.uk [195.92.195.177]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBQ2YEL92890 for ; Mon, 25 Dec 2000 21:34:14 -0500 (EST) (envelope-from abe@fish.tm) Received: from [195.92.67.23] (helo=mail18.svr.pol.co.uk) by cmailg7.svr.pol.co.uk with esmtp (Exim 3.13 #0) id 14Ajwg-0006l5-00; Tue, 26 Dec 2000 02:34:34 +0000 Received: from modem-26.foxface.dialup.pol.co.uk ([62.137.15.26] helo=win2k) by mail18.svr.pol.co.uk with smtp (Exim 3.13 #0) id 14Ajwe-0001Yw-00; Tue, 26 Dec 2000 02:34:33 +0000 Message-ID: <002e01c06ee5$6abe5ac0$6500a8c0@win2k> From: "Abe" To: "mlw" , "Hackers List" References: <001001c06ec8$36bec380$6500a8c0@win2k> <3A47D6E7.E85FACDE@mohawksoft.com> Subject: Re: COUNT(Distinct city) HELP!!! Date: Tue, 26 Dec 2000 02:41:56 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200012/992 X-Sequence-Number: 2521 Hey there, Just tried that - No luck - I am using version 6.5.0 - Maybe its just not available in this version. Any alternatives ? Thanks Guys, Abe ----- Original Message ----- From: "mlw" To: "Abe" ; "Hackers List" Sent: Monday, December 25, 2000 11:23 PM Subject: Re: COUNT(Distinct city) HELP!!! > Abe wrote: > > > > Part 1.1 Type: Plain Text (text/plain) > > Encoding: quoted-printable > > Try this: > select count(distinct (city) ) from ct > -- > http://www.mohawksoft.com > From araman@india-today.com Tue Dec 26 06:43:43 2000 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 >> From abe@fish.tm Tue Dec 26 12:14:02 2000 Received: from cmailg7.svr.pol.co.uk (cmailg7.svr.pol.co.uk [195.92.195.177]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBQC6JL28719 for ; Tue, 26 Dec 2000 07:06:19 -0500 (EST) (envelope-from abe@fish.tm) Received: from [195.92.67.23] (helo=mail18.svr.pol.co.uk) by cmailg7.svr.pol.co.uk with esmtp (Exim 3.13 #0) id 14AssI-0005yY-00; Tue, 26 Dec 2000 12:06:38 +0000 Received: from modem-229.garibaldi.dialup.pol.co.uk ([62.137.16.229] helo=win2k) by mail18.svr.pol.co.uk with smtp (Exim 3.13 #0) id 14AssG-00057X-00; Tue, 26 Dec 2000 12:06:37 +0000 Message-ID: <000e01c06f35$567609a0$6500a8c0@win2k> From: "Abe" To: "Anand Raman" , References: <001001c06ec8$36bec380$6500a8c0@win2k> <20001226121343.A683@india-today.com> Subject: Re: COUNT(Distinct city) HELP!!! Date: Tue, 26 Dec 2000 12:14:02 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200012/710 X-Sequence-Number: 1994 No Joy, unfortunately - It may well be time to upgrade. Thanks, Abe ----- Original Message ----- From: "Anand Raman" To: Sent: Tuesday, December 26, 2000 6:43 AM Subject: Re: [GENERAL] COUNT(Distinct city) HELP!!! > 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 > >> >