Hi there,
Doesn't seem to be a FAQ so here goes with a question
My MySQL manual has the following to say about how to count the number
of distinct values in a particular column
COUNT(DISTINCT expr,[expr...])
Returns a count of the number of different values.
mysql> select COUNT(DISTINCT results) from student;
however on the MySQL versions I currently have access to (3.22.32 &
3.22.34) I get this:
mysql> select COUNT(DISTINCT SOME_COLUMN) from SOME_TABLE;
ERROR 1064: You have an error in your SQL syntax near 'DISTINCT
SOME_COLUMN) from SOME_TABLE' at line 1
whereas
mysql> select COUNT(SOME_COLUMN) from SOME_TABLE;
works fine
I am assuming that either this function is not available or that it is a
bug that has been fixed in a later release (or is on a todo list
somewhere).
Can anybody fill me in?
Thanks in advance
CHEERS> SAM
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
- Re: COUNT(DISTINCT some_column) Sam Joseph
- Re: COUNT(DISTINCT some_column) Peter Skipworth
- Re: COUNT(DISTINCT some_column) Fred van Engen
- Re: COUNT(DISTINCT some_column) Peter Skipworth