| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Thimble Smith | Date: | May 1 1999 10:03am |
| Subject: | Re: DISTINCT and COUNT() SQL Query | ||
| View as plain text | |||
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).
| Thread | ||
|---|---|---|
| • DISTINCT and COUNT() SQL Query | Mike Machado | 1 May |
| • Re: DISTINCT and COUNT() SQL Query | jkraai | 1 May |
| • Re: DISTINCT and COUNT() SQL Query | Paul DuBois | 1 May |
| • RE: DISTINCT and COUNT() SQL Query | Don Read | 1 May |
| • Re: DISTINCT and COUNT() SQL Query | Mike Machado | 1 May |
| • Re: DISTINCT and COUNT() SQL Query | Thimble Smith | 1 May |
| • Re: DISTINCT and COUNT() SQL Query | Jim Faucette | 1 May |
| • 3.22.21 RAM Usage | jkraai | 2 May |
| • 3.22.21 RAM Usage | Michael Widenius | 2 May |
| • Re: 3.22.21 RAM Usage | jkraai | 2 May |
| • a problem | glen | 19 May |
| • Re: a problem (The table 'SQL134597_0' is full) | Pete Harlan | 20 May |
| • Re: a problem (The table 'SQL134597_0' is full) | glen | 20 May |
| • Re: a problem (The table 'SQL134597_0' is full) | Benjamin Pflugmann | 21 May |
| • Re: a problem (The table 'SQL134597_0' is full) | Michael Widenius | 24 May |
