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 2000 Forums
 Transact-SQL (2000)
 duplication

Author  Topic 

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2004-01-07 : 10:33:26
I have a table of 100,000 patients containing FirstName, LastName, DateOfBirth, PostCode,...

What is the most effective way to identify those who are duplicated based on the four fields above being duplicates

many thanks

steve

Steve no function beer well without

nr
SQLTeam MVY

12543 Posts

Posted - 2004-01-07 : 10:38:28
select FirstName, LastName, DateOfBirth, PostCode, count(*)
from tbl
group by FirstName, LastName, DateOfBirth, PostCode
having count(*) > 1

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2004-01-09 : 08:16:14
DOH!

Thanks.

Steve
--

One day it won't be a stupid day!
Go to Top of Page
   

- Advertisement -