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







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|     londontim | 
     15|     pariskim | 
    17|     munichte   
|      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
Mon, 25 Dec 2000 23:12:50 -0000
"Abe" <abe@fish.tm>
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

Mon, 25 Dec 2000 18:23:19 -0500
mlw <markw@mohawksoft.com>
Re: COUNT(Distinct city) HELP!!!

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
> 


Mon, 25 Dec 2000 17:27:30 -0800 (PST)
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Re: COUNT(Distinct city) HELP!!!
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

Mon, 25 Dec 2000 20:08:24 -0600
GH <grasshacker@over-yonder.net>
Re: COUNT(Distinct city) HELP!!!
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" <markw@mohawksoft.com>
> To: "Abe" <abe@fish.tm>; "Hackers List" <pgsql-hackers@postgresql.org>
> 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

Mon, 25 Dec 2000 21:39:47 -0500
mlw <markw@mohawksoft.com>
Re: COUNT(Distinct city) HELP!!!
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" <markw@mohawksoft.com>
To: "Abe" <abe@fish.tm>; "Hackers List" <pgsql-hackers@postgresql.org>
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
>


Tue, 26 Dec 2000 02:41:56 -0000
"Abe" <abe@fish.tm>
Re: 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
>> 

Tue, 26 Dec 2000 12:13:43 +0530
Anand Raman <araman@india-today.com>
Re: COUNT(Distinct city) HELP!!!
No Joy,
unfortunately - It may well be time to upgrade.

Thanks,
Abe


----- Original Message -----
From: "Anand Raman" <araman@india-today.com>
To: <pgsql-general@postgresql.org>
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
> >>
>


Tue, 26 Dec 2000 12:14:02 -0000
"Abe" <abe@fish.tm>
Re: COUNT(Distinct city) HELP!!!