Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

finding duplicates in 2 tables using MSSQL 2005

Posted on 2010-11-29
2
Medium Priority
?
289 Views
Last Modified: 2012-05-10
How do is find duplicates from 2 "different" tables using mssql 2005?
Need to check on the address1 and address2 fields.
Database 1 is contacts
Database 2 is leads

thx bob
0
Comment
Question by:goldmineexpert
2 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 1000 total points
ID: 34235775
select * from contacts c
where exists (select * from leads l
  where l.address1 = c.address1 and c.address2 = l.address2)

And v.v. for the leads table to find duplicates in the other
0
 
LVL 1

Assisted Solution

by:_DJ
_DJ earned 1000 total points
ID: 34236531
SELECT address1, address2 FROM contacts
INTERSECT
SELECT address1, address2 FROM leads
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question