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
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/
On Fri, 28 Jun 2002 00:10:56 -0500, Julie Keywell <julie@iparenting.com> 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
Julie:
--- Julie Keywell <julie@iparenting.com> 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(<column name>))
FROM .....
ludwig
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера