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

Databases Forum

    
Select Distinct Help
mummrah




msg:1579542
 12:34 pm on Aug 30, 2005 (gmt 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!

 

arran




msg:1579543
 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]

arran.

tomasz




msg:1579544
 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