SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Identifying Duplicate Records
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kishore7
Starting Member

13 Posts

Posted - 07/23/2012 :  20:05:18  Show Profile  Reply with Quote
Hi,

I have two tables A and B , both tables are joined by UserID
In table A i have a columns DOB, First-name and in table B i have column IP,
now i need to count all the duplicate records.
Also i need to list first-name of all those duplicate records
I am Using sql server 2008

*The criteria to find duplicate record is ,it should have same DOB and IP

Please help me out, i couldn't come up with a proper query for this....

Edited by - kishore7 on 07/23/2012 20:10:55

singularity
Posting Yak Master

149 Posts

Posted - 07/23/2012 :  20:16:25  Show Profile  Reply with Quote

select first_name, DOB, IP
from
(select first_name, DOB, IP, count(*) over (partition by DOB, IP) as cnt
from a
join b on a.UserID = b.UserID) q
where cnt > 1


Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000