Re: eliminating dupes from MySQL query results
| From: | Chris Wanstrath | Date: | Sat, 01 Nov 2003 23:49:17 +0000 |
| Subject: | Re: eliminating dupes from MySQL query results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168307@lists.php.net to get a copy of this message | ||
On Sat, 2003-11-01 at 16:29, Robb Kerr wrote:
> It's not exactly a Php problem, but MySQL and Php seem to be so intertwined
> and this newsgroup has been so unbelievably helpful that I thought I'd post
> the question here.
>
> I've got a query which returns a group of records. the field which I want
> to display in a list contains many duplicates. I need to remove all
> duplicates so that each entry is only displayed once. Another query based
> upon a selection from this list will display all of the appropriate
> records.
>
> Can anybody help with the syntax? Do I need a loop or is there a MySQL
> command/function which I am overlooking?
>
> Thanx,
> --
> Robb Kerr
> Digital IGUANA
> Helping Digital Artists Achieve their Dreams
> http://www.digitaliguana.com
> http://www.cancerreallysucks.org
You'll want to do a SELECT DISTINCT rather than simply a SELECT for your
SQL query.
SELECT DISTINCT filters out duplicate results from a query. Hope this
helps.
- Chris