Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 29th, 2004, 12:30 PM
huskerboy huskerboy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 2 huskerboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How do I clenup duplicate record with a query

I have a query that is giving me results from table1.name = table2.name and table1.name=table3.name. Table1 is the main table 1 is the main table with all names in the company in it. Table 2 has only certain names in it and Table 3 only has some names in it. I need the names that match from table2 and table3 but I need to fine a way to cleanup duplicate names in the same query. If the name is in Table2 and Table3 I get to instances of the name. I only want to see on instance of the name. Can some one help me.

Thanks in Advance

Reply With Quote
  #2  
Old January 29th, 2004, 02:31 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
have you tried SELECT DISTINCT?

otherwise, perhaps show us some small sample data... i know i'm kind of confused with your description =)

Reply With Quote
  #3  
Old February 2nd, 2004, 08:58 AM
alansmith alansmith is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Seaton Devon
Posts: 18 alansmith User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 sec
Reputation Power: 0
Send a message via MSN to alansmith Send a message via Yahoo to alansmith
if distinct dosent work

You may need to group your results.


select table1.code,table2.name from table1, table2 where table1.code=table2.code group by table1.code.

This would apply when a code has more than one name.

select distinct table1.code,table2.name from table1, table2 where table1.code=table2.code group by table1.code.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > How do I clenup duplicate record with a query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT