List:General Discussion« Previous MessageNext Message »
From:Karl Pielorz Date:June 4 1999 8:41pm
View as plain text  
Hi All,

I just found a handy SELECT in the mail archives, a simple example would be:

SELECT name, COUNT(*) FROM contacts GROUP BY name;

Which returns every contact name, along with the number of occurances...

What I couldn't find in the archives, is a way of doing:

SELECT the number of distinct names FROM contacts;

And have the query just return a single number, e.g. 57 (There are 57
different names in the 'contacts' table).

Is this possible? - I can't find any way to combine the DISTINCT and COUNT()
clauses in a SELECT statement in order to achieve this in one simple step...

Any suggestions?


DISTINCT SELECT's?Karl Pielorz5 Jun