not load duplicate criteria from mysql

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
jim_php
Forum Newbie
Posts: 16
Joined: Sat Mar 22, 2008 6:16 am

not load duplicate criteria from mysql

Post by jim_php »

hello i have one mysql and i wan to load some records with where.....
but in some records has duplicate values

example
select all records form some database ...

results ........
id = 1, first_name = jim, mobile = 123456789,
id = 2, first_name = george, mobile = 123456789,


i dont want load the second record because has the same mobile...

the records is too many...
and the duplicates are also many....

any idea ?
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Re: not load duplicate criteria from mysql

Post by Bill H »

SELECT FROM (blah, blah) LIMIT 1
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: not load duplicate criteria from mysql

Post by jayshields »

Use the GROUP BY and/or DISTINCT clause.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: not load duplicate criteria from mysql

Post by califdon »

If you're still having a problem, please show us your exact SQL statement, and which field is the one that has duplicate values.
Post Reply