pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem to count (distinct number)
4+ messages / 4 participants
[nested] [flat]
* problem to count (distinct number)
@ 2001-01-17 15:51 Mikael Hedin <mikael.hedin@irf.se>
2001-01-18 20:59 ` Re: problem to count (distinct number) Jie Liang <jliang@ipinc.com>
2001-01-18 21:01 ` Re: problem to count (distinct number) Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-01-18 21:09 ` Re: problem to count (distinct number) Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 3 replies; 4+ messages in thread
From: Mikael Hedin @ 2001-01-17 15:51 UTC (permalink / raw)
To: pgsql-sql
Hi,
I have a table with a column (int4), and I want to know how many
different numbers there are. In an example book I saw the query
SELECT COUNT (DISTINCT data ) FROM media;
by then I get
ERROR: parser: parse error at or near "distinct"
Is the query in error or does PostgreSQL not support this? How do I
then get the number of distinct data from my table?
TIA,
Micce
--
Mikael Hedin, MSc +46 (0)980 79176
Swedish Institute of Space Physics +46 (0)8 344979 (home)
S-Box 812, 981 28 KIRUNA, Sweden +46 (0)70 5891533 (mobile)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: problem to count (distinct number)
2001-01-17 15:51 problem to count (distinct number) Mikael Hedin <mikael.hedin@irf.se>
@ 2001-01-18 20:59 ` Jie Liang <jliang@ipinc.com>
2 siblings, 0 replies; 4+ messages in thread
From: Jie Liang @ 2001-01-18 20:59 UTC (permalink / raw)
To: Mikael Hedin <mikael.hedin@irf.se>; +Cc: pgsql-sql
hi,there,
I don't see the problem except extra space, try:
SELECT COUNT(DISTINCT data) FROM media;
Jie LIANG
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.ipinc.com
On 17 Jan 2001, Mikael Hedin wrote:
> Hi,
>
> I have a table with a column (int4), and I want to know how many
> different numbers there are. In an example book I saw the query
>
> SELECT COUNT (DISTINCT data ) FROM media;
>
> by then I get
>
> ERROR: parser: parse error at or near "distinct"
>
> Is the query in error or does PostgreSQL not support this? How do I
> then get the number of distinct data from my table?
>
> TIA,
>
> Micce
>
>
> --
> Mikael Hedin, MSc +46 (0)980 79176
> Swedish Institute of Space Physics +46 (0)8 344979 (home)
> S-Box 812, 981 28 KIRUNA, Sweden +46 (0)70 5891533 (mobile)
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: problem to count (distinct number)
2001-01-17 15:51 problem to count (distinct number) Mikael Hedin <mikael.hedin@irf.se>
@ 2001-01-18 21:01 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2 siblings, 0 replies; 4+ messages in thread
From: Stephan Szabo @ 2001-01-18 21:01 UTC (permalink / raw)
To: Mikael Hedin <mikael.hedin@irf.se>; +Cc: pgsql-sql
What version are you using? I believe this was added in 7.0.x, but
I could be wrong about that. A query of this sort works on my
7.1beta3 system.
On 17 Jan 2001, Mikael Hedin wrote:
> I have a table with a column (int4), and I want to know how many
> different numbers there are. In an example book I saw the query
>
> SELECT COUNT (DISTINCT data ) FROM media;
>
> by then I get
>
> ERROR: parser: parse error at or near "distinct"
>
> Is the query in error or does PostgreSQL not support this? How do I
> then get the number of distinct data from my table?
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: problem to count (distinct number)
2001-01-17 15:51 problem to count (distinct number) Mikael Hedin <mikael.hedin@irf.se>
@ 2001-01-18 21:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2001-01-18 21:09 UTC (permalink / raw)
To: Mikael Hedin <mikael.hedin@irf.se>; +Cc: pgsql-sql
Mikael Hedin <mikael.hedin@irf.se> writes:
> SELECT COUNT (DISTINCT data ) FROM media;
> ERROR: parser: parse error at or near "distinct"
This is supported since 7.0. I suspect you are running an old release.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-01-18 21:09 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-01-17 15:51 problem to count (distinct number) Mikael Hedin <mikael.hedin@irf.se>
2001-01-18 20:59 ` Jie Liang <jliang@ipinc.com>
2001-01-18 21:01 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-01-18 21:09 ` Tom Lane <tgl@sss.pgh.pa.us>
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