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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query for Identifying Duplicacy

Author  Topic 

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-23 : 10:41:18
I have table <contact>

I wand to higllight the duplicate student .I am considering two parameter Name and Birthdate to identify such records even though the probablity of two different student having same name and same DOB is very less.Margin for bad result is relatively low for me.


fisrtname middlename lastName birthdate
------------------------------------------------

peter jones clooney 29/06/2008
peter jones clooney 29/06/2008

both are actually same student but different from database point of view.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-23 : 10:59:48
[code]SELECT t.fisrtname,t.middlename,t.lastName,t.birthdate
FROM
(SELECT ROW_NUMBER() OVER PARTITION BY (fisrtname,middlename,lastName ORDER BY birthdate) AS RowNo,
*
FROM YourTable)t
WHERE t.RowNo=1[/code]
Go to Top of Page

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2008-06-24 : 04:03:46
It has worked really with slighty modification from my side.
Thanx.
Always expectin result from you.
Go to Top of Page
   

- Advertisement -