From: Brett W. McCoy <bmccoy@chapelperilous.net>
To: G. Anthony Reina <reina@nsi.edu>
Cc: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
Subject: Re: Counting distinct names
Date: Mon, 17 Apr 2000 22:16:09 -0400 (EDT)
Message-ID: <Pine.LNX.4.10.10004172202030.6329-100000@chapelperilous.net> (raw)
In-Reply-To: <38FBBD02.4424CB34@nsi.edu>
On Mon, 17 Apr 2000, G. Anthony Reina wrote:
> 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;
SELECT
DISTINCT(subject_name),
COUNT(subject_name)
FROM
table1
GROUP BY
subject_name
;
Brett W. McCoy
http://www.chapelperilous.net
---------------------------------------------------------------------------
Anything that is good and useful is made of chocolate.
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: bmccoy@chapelperilous.net, reina@nsi.edu
Subject: Re: Counting distinct names
In-Reply-To: <Pine.LNX.4.10.10004172202030.6329-100000@chapelperilous.net>
References: <38FBBD02.4424CB34@nsi.edu> <Pine.LNX.4.10.10004172202030.6329-100000@chapelperilous.net>
* 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