Re: DISTINCT and COUNT help

From: Chris <csmith(at)squiz(dot)net>
To: Julie Keywell <julie(at)iparenting(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: DISTINCT and COUNT help
Date: 2002-06-28 05:20:50
Message-ID: 5.1.0.14.0.20020628151949.027f1d70@cooee.cybersydney.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi Julie,

>I would like to count the number of distinct values in a column. Is
>there any way to combine DISTINCT and COUNT and if so, what is the
>syntax?

Sure is.

SELECT DISTINCT column, COUNT(column) FROM table GROUP BY column;

HTH,

-----------------
Chris Smith
http://www.squiz.net/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Manfred Koizar 2002-06-28 09:24:50 Re: DISTINCT and COUNT help
Previous Message Julie Keywell 2002-06-28 05:10:56 DISTINCT and COUNT help