Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Select Distinct Help



12:34 pm on Aug 30, 2005 (gmt 0)

10+ Year Member


Hope someone can help me with this!

I have a fairly large database containing the following fields..

email , firstname , surname, address1, address2,

However it contains many duplicate entires and would like to be able to select distinct entries based on email address.


select distinct email from tbl_users

Gives me the distinct email address,

select distinct email ,firstname, Surname, from tbl_users

gives me a number of duplicates if someone has entered thier name diffently i.e diplays:

joe@email.com fistname surname
joe@email.com 1stname surname

Hope there is an easy solution that I've missed!


12:54 pm on Aug 30, 2005 (gmt 0)

10+ Year Member

Hi mummrah,

This topic was covered recently in the php forum. Check out my post (#4) in this thread [webmasterworld.com]



1:20 pm on Aug 30, 2005 (gmt 0)

10+ Year Member

use this instead;
select count(0)as howmany, email ,firstname, Surname
from tbl_users
WHERE count(0)>1
group by count(0),email,firstname,surname

this query will display only duplicates.


Featured Threads

Hot Threads This Week

Hot Threads This Month