problem to count (distinct number)

From: Mikael Hedin <mikael(dot)hedin(at)irf(dot)se>
To: pgsql-sql(at)postgresql(dot)org
Subject: problem to count (distinct number)
Date: 2001-01-17 15:51:34
Message-ID: 8766jemb21.fsf@zodiac.irf.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-01-17 16:36:21 Re: Re: Boolean and Bit
Previous Message Tom Lane 2001-01-17 15:28:15 Re: sort order with < & > in varchar fields