Counting distinct names - Mailing list pgsql-sql

From G. Anthony Reina
Subject Counting distinct names
Date
Msg-id 38FBBD02.4424CB34@nsi.edu
Whole thread Raw
Responses Re: Counting distinct names  ("Brett W. McCoy" <bmccoy@chapelperilous.net>)
Re: Counting distinct names  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Let's say I have a table:

table1
=====

subject_name         text
subject_age            int4
test_trial                int4
test_score               int4


I'd like to find out how many times a unique 'subject_name' is in the
table. My SQL book says that I should be able to do this:

select COUNT(DISTINCT subject_name) from table1;

However, the psql program is giving me an "ERROR:  parser: parse error
at or near "distinct"".

Is there another way to do this (or a problem with my query)?

Thanks.
-Tony Reina

Using [PostgreSQL 6.5.1 on i686-pc-linux-gnu, compiled by gcc
egcs-2.91.66]




pgsql-sql by date:

Previous
From: Titus Brown
Date:
Subject: Re: [GENERAL] Connecting website with SQL-database.....
Next
From: "Brett W. McCoy"
Date:
Subject: Re: Counting distinct names