[Solved] Filtering out duplicated results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

[Solved] Filtering out duplicated results

Post by Addos »

I wonder if anybody can give me some pointers as to how to deal with filtering out duplicated results. I have a setup where I have names and addresses that depending on the query can sometimes return duplicate names and addresses. Is this easy to do? I just can’t think of how to approach this in PHP.
Thanks a mil
Brian
Last edited by Addos on Fri May 27, 2005 6:40 am, edited 1 time in total.
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Post by harrisonad »

use GROUP BY in your query.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

Code: Select all

$query = "SELECT distinct something FROM somewhere";
$result = mysql_query($query) or die (mysql_error());
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

Post by Addos »

Thanks the 'Group By' was what I needed. :oops:

Brian
Post Reply