Re: Counting distinct names - Mailing list pgsql-sql

From Brett W. McCoy
Subject Re: Counting distinct names
Date
Msg-id Pine.LNX.4.10.10004172202030.6329-100000@chapelperilous.net
Whole thread Raw
In response to Counting distinct names  ("G. Anthony Reina" <reina@nsi.edu>)
List pgsql-sql
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.



pgsql-sql by date:

Previous
From: "G. Anthony Reina"
Date:
Subject: Counting distinct names
Next
From: Tom Lane
Date:
Subject: Re: Counting distinct names