homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Select Distinct Help

10+ Year Member

Msg#: 4 posted 12:34 pm on Aug 30, 2005 (gmt 0)


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!



5+ Year Member

Msg#: 4 posted 12:54 pm on Aug 30, 2005 (gmt 0)

Hi mummrah,

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



10+ Year Member

Msg#: 4 posted 1:20 pm on Aug 30, 2005 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved