Received: from nsi.edu (amethea.nsi.edu [198.133.185.9]) by hub.org (8.9.3/8.9.3) with ESMTP id VAA22565 for ; Mon, 17 Apr 2000 21:31:47 -0400 (EDT) (envelope-from reina@nsi.edu) Received: from nsi.edu (o21.nsi.edu [204.128.156.216]) by nsi.edu (8.9.1/8.9.1) with ESMTP id SAA14050 for ; Mon, 17 Apr 2000 18:31:26 -0700 (PDT) Message-ID: <38FBBD02.4424CB34@nsi.edu> Date: Mon, 17 Apr 2000 18:40:18 -0700 From: "G. Anthony Reina" Organization: The Neurosciences Institute X-Mailer: Mozilla 4.7 [en] (X11; U; IRIX 6.5 IP32) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-sql@postgreSQL.org" Subject: Counting distinct names Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200004/175 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]