From: Thimble Smith Date: May 1 1999 10:03am Subject: Re: DISTINCT and COUNT() SQL Query List-Archive: http://lists.mysql.com/mysql/2737 Message-Id: <19990501030359.C8522@desert.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii This has been answered correctly and incorrectly many times. If you read the archives you'll find it. If anyone is compiling a list of FAQs, this is definitely one that should be on it. The correct answer, for now, is this: do this query: SELECT DISTINCT name FROM table_name; or (is the same as): SELECT name FROM table_name GROUP BY name; Now what you're looking for is in mysql_num_rows(). Look at the C API description of mysql_num_rows for warnings about mysql_ use_result vs. mysql_store_result. Tim On Fri, Apr 30, 1999 at 09:44:05PM -0700, Mike Machado wrote: > Yes! I want the number of distinct names. None of the earlier > queries give me what I'm looking for. I want the number of > distinct names in the same way as a 'select count(*) from > names' would, exept that would give me all the entries (count > the same name multiple times).