pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
COUNT(Distinct city) HELP!!!
8+ messages / 5 participants
[nested] [flat]

* COUNT(Distinct city) HELP!!!
@ 2000-12-25 23:12  Abe <abe@fish.tm>
  0 siblings, 3 replies; 8+ messages in thread

From: Abe @ 2000-12-25 23:12 UTC (permalink / raw)
  To: pgsql-hackers; pgsql-general@postgresql.org

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

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-25 23:23  mlw <markw@mohawksoft.com>
  parent: Abe <abe@fish.tm>
  2 siblings, 1 reply; 8+ messages in thread

From: mlw @ 2000-12-25 23:23 UTC (permalink / raw)
  To: Abe <abe@fish.tm>; pgsql-hackers

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-26 01:27  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Abe <abe@fish.tm>
  2 siblings, 1 reply; 8+ messages in thread

From: Stephan Szabo @ 2000-12-26 01:27 UTC (permalink / raw)
  To: Abe <abe@fish.tm>; +Cc: pgsql-hackers; pgsql-general@postgresql.org


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
> 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-26 02:08  GH <grasshacker@over-yonder.net>
  parent: Abe <abe@fish.tm>
  2 siblings, 0 replies; 8+ messages in thread

From: GH @ 2000-12-26 02:08 UTC (permalink / raw)
  To: Abe <abe@fish.tm>; +Cc: pgsql-general@postgresql.org

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-26 02:39  mlw <markw@mohawksoft.com>
  parent: Abe <abe@fish.tm>
  0 siblings, 0 replies; 8+ messages in thread

From: mlw @ 2000-12-26 02:39 UTC (permalink / raw)
  To: Abe <abe@fish.tm>; +Cc: pgsql-hackers

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-26 02:41  Abe <abe@fish.tm>
  parent: mlw <markw@mohawksoft.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Abe @ 2000-12-26 02:41 UTC (permalink / raw)
  To: mlw <markw@mohawksoft.com>; pgsql-hackers

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
>




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-26 06:43  Anand Raman <araman@india-today.com>
  parent: Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Anand Raman @ 2000-12-26 06:43 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

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
>> 



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: COUNT(Distinct city) HELP!!!
@ 2000-12-26 12:14  Abe <abe@fish.tm>
  parent: Anand Raman <araman@india-today.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Abe @ 2000-12-26 12:14 UTC (permalink / raw)
  To: Anand Raman <araman@india-today.com>; pgsql-general@postgresql.org

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
> >>
>




^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2000-12-26 12:14 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-25 23:12 COUNT(Distinct city) HELP!!! Abe <abe@fish.tm>
2000-12-25 23:23 ` mlw <markw@mohawksoft.com>
2000-12-26 02:41   ` Abe <abe@fish.tm>
2000-12-26 02:39     ` mlw <markw@mohawksoft.com>
2000-12-26 01:27 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2000-12-26 06:43   ` Anand Raman <araman@india-today.com>
2000-12-26 12:14     ` Abe <abe@fish.tm>
2000-12-26 02:08 ` GH <grasshacker@over-yonder.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox