Jean-Guy2000
April 12th, 2001, 12:31 PM
I have a access database containing a table called Contact, the table contains these fields Name,Address,Phone. I need to find the duplicate phone #'s and remove all but 1 of them from the database. I do not have a primary key and I cannot add one. (if I add it I have to do it programatically) Any Idea how to do this without looping thru the database (some of these databases contain over 10,000 rows ) ????
Jean-Guy
Johnny101
April 12th, 2001, 01:06 PM
Isn't there a Find Duplicates wizard in Access? I think if you goto Insert, then Query - in the New Query window - choose Find Duplicates Wizard, you can get a query that will do this for you. otherwise, you could something like this:
SELECT
PhoneNumber
FROM
Table
GROUP BY
PhoneNumber
HAVING
Count(PhoneNumber) > 1
that would at least get you a list of all the duplicates, then you'd have write some other query that would delete them.
good luck,
john
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org