From: Hank Eskin Date: March 13 1999 1:35pm Subject: Select Count(Distinct ) from ... List-Archive: http://lists.mysql.com/mysql/157 Message-Id: <36EA6983.F1B458CB@ix.netcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit There were recently two identical questions posted, with two identical answers, neither of which do what is needed. I have the same need, but have not found a single query to do this. I need to do: SELECT COUNT(DISTINCT ) from ; or SELECT COUNT(DISTINCT ,,) from ; In other words, I want ONE record returned, with the total COUNT of DISTINCT values in the table. The proposed (incorrect) solutions were both: SELECT count(*) FROM GROUP BY ; This just returns the count of records for each distinct , which is identical to SELECT , count(*) from GROUP BY ; just without the key field in the output - one record for each distinct in the table. The only solution I have used to do this is issue: SELECT , count(*) from GROUP BY ; and then get the mysql_NUMROWS (using PHP3). So, is there a way, in one simple query to return this value? Thanks, -Hank p.s. Oracle handles this very well... ;)