DISTINCT and COUNT help

Поиск
Список
Период
Сортировка
Искать

DISTINCT and COUNT help

От:
Julie Keywell <julie@iparenting.com>
Дата:
Hi there!

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?

Thanks for your help!
Julie





Re: DISTINCT and COUNT help

От:
Chris <csmith@squiz.net>
Дата:
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/



Re: DISTINCT and COUNT help

От:
Manfred Koizar <mkoi-pg@aon.at>
Дата:
On Fri, 28 Jun 2002 00:10:56 -0500, Julie Keywell  wrote:
>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?
Julie, it's so obvious, you didn't dare to think of it :-)

SELECT COUNT(DISTINCT col) FROM t;

Servus
 Manfred


Re: DISTINCT and COUNT help

От:
Ludwig Lim <lud_nowhere_man@yahoo.com>
Дата:

Julie:

--- Julie Keywell  wrote:
> Hi there!
> 
> 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?

try SELECT COUNT(DISTINCT())
    FROM .....


ludwig


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com


FAQ