Need the SQL of a Find Duplicates Query please!

  • Thread starter Thread starter lover
  • Start date Start date
L

lover

Can somebody please post the SQL up here to find duplicate values in a
column of a table.

I confess: I always used the wizard for this and I don't know how to write
my own! (But i'm not using access right now, so ... no wizard!)

all I need is a simple, generic template to work off of.

help a newbie out?
 
OK sorry for the spam but I think I've got something

SELECT * FROM SomeTable t1 JOIN SomeTable t2 ON
t1.ColumnYouWantToCheckForDupes= t2.ColumnYouWantToCheckForDupes [,
t1.AnotherColumnToCheck = t2.AnotherColumnToCheck, etc...] WHERE
t1.PrimaryKeyOrOtherUID <> tc2.PrimaryKeyOrOtherUID

the only thing I'm not sure how to do is execute this on tables with no
PK/Unique Index...

I think you have to add every other column except the columns you are
checking for duplicates to the WHERE clause.

GL HTH somebody! =)

if anybody has a better form to share, please do! =)

THANKS!
 
Back
Top