RE: [PHP] mySQL Question....
| From: | Opec Kemp \( Ozemail \) | Date: | Wed, 18 Apr 2001 05:54:37 +0000 |
| Subject: | RE: [PHP] mySQL Question.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49124@lists.php.net to get a copy of this message | ||
> if i perform a SELECT query (say) like the following:
>
> SELECT email_addr FROM myTable WHERE x = 1
>
> in this query i want to pull-out (or list) all email
> addresses where x equals 1, however, suppose i don't want any
> duplicate email addresses... would i use ORDER BY and COUNT(*) to
get listing
> of non-duplicate email addresses, and just ignore the COUNT() ?
You would use neither :) To get the distict email addressese you can
use
SELECT email_addr FROM myTable WHERE x = 1 GROUP BY email_addr
Check MySQL manual for SELECT options for more info.