Welcome to WebmasterWorld Guest from 54.144.80.75

Forum Moderators: open

Message Too Old, No Replies

Select Distinct Help

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

New User

10+ Year Member

joined:Oct 4, 2004
posts:13
votes: 0


Hi,

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.

While

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)

Preferred Member

10+ Year Member

joined:Feb 16, 2005
posts:456
votes: 0


Hi mummrah,

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

arran.

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

Full Member

10+ Year Member

joined:May 15, 2002
posts:236
votes: 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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members