Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Identifying Duplicate Records

Author  Topic 

kishore7
Starting Member

13 Posts

Posted - 2012-07-23 : 20:05:18
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....

singularity
Posting Yak Master

153 Posts

Posted - 2012-07-23 : 20:16:25
[code]
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
[/code]

Go to Top of Page
   

- Advertisement -