pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: G. Anthony Reina <reina@nsi.edu>
To: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
Subject: Counting distinct names
Date: Mon, 17 Apr 2000 18:40:18 -0700
Message-ID: <38FBBD02.4424CB34@nsi.edu> (raw)

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]





view thread (12+ messages)  latest in thread

Message-ID: <38FBBD02.4424CB34@nsi.edu>
Permalink:  ../38FBBD02.4424CB34@nsi.edu/
Also on:    postgresql.org/message-id/38FBBD02.4424CB34@nsi.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: reina@nsi.edu
  Subject: Re: Counting distinct names
  In-Reply-To: <38FBBD02.4424CB34@nsi.edu>
  References: <38FBBD02.4424CB34@nsi.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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