Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Manfred KoizarDate: 2002-06-28 09:24:50
Subject: Re: DISTINCT and COUNT help
Previous:From: Julie KeywellDate: 2002-06-28 05:10:56
Subject: DISTINCT and COUNT help

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group