Solved

finding duplicates in 2 tables using MSSQL 2005

Posted on 2010-11-29
2
248 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 250 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 250 total points
ID: 34236531
SELECT address1, address2 FROM contacts
INTERSECT
SELECT address1, address2 FROM leads
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get Duration of last Status Update 4 35
MS SQL + Insert Into Table - If Doesnt Exist 9 35
sql how to count case when 4 16
PROPERCASE SCRIPT IN SQL 3 6
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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