Solved

finding duplicates in 2 tables using MSSQL 2005

Posted on 2010-11-29
2
256 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

837 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