Skip to main content
August 5, 2008
Question

Delete Duplicate Records in Table

  • August 5, 2008
  • 2 replies
  • 474 views
Greetings

I have a table in which several (25%) of 6000 records were entered in error. The address field is identical- some have 4 or more erroneous entries.

The correct records contain a phone number field whereas the duplicates do not.

Could I do something like:

<cfquery name="get_dupes">
SELECT LocationID, address1, Phone
FROM Location
</cfquery>

then:

<cfquery name="delete_dupes"
datasource="someDB">
DELETE FROM Location
WHERE #get_dupes.address1# LIKE Something here ????
AND #get_dupes.Phone# IS ""
</cfquery>

CF 8, Access.

Thanks in advance-

newportri

This topic has been closed for replies.

2 replies

August 5, 2008
Dan:

That was great- did the trick and also saved the few records that were not dupes but had no phone listed for whatever reason- Thanks...

newportri
Inspiring
August 5, 2008
delete from yourtable
where phonenumber is null
and address in
(select address
from yourtable
where phonenumber is not null)