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
 Old Forums
 CLOSED - General SQL Server
 duplicates expansion

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-22 : 10:23:17
KevinU writes "1st, I appreciate all the info this site has provided me. Thank you and keep up the great work. 2nd, I know about finding dupes using COUNT and so forth. my question is based on I want to keep the duplicate info. so far all I have been able to do is get the results to show me totals of dupes for @ record using the GROUPBY clause. I want to be able to see @ row individually.

the reason being I have dupe info, like acct#s and ssn#, but the other fields contain different info I need to compare.

Again, thank you for your time and a great info source!

KevinU.

Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Developer Edition on Windows NT 5.0 (Build 2195: Service Pack 4)"

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-09-22 : 11:02:19
I'm not sure what you're saying. Is it that you want to see the entire row (all columns) but only for rows that have duplicate ssn for example?

select *
from myTable a
join (--only rows with dupes
select ssn
from myTable
group by ssn
having count(*) > 1
) b
on b.ssn = a.ssn
order by a.ssn


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -