homepage Welcome to WebmasterWorld Guest from 54.242.188.217
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library : Charter : Moderators: physics & whoisgregg

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved