Hi All,
I am trying to run a delete query that removes duplicate records in a table. However, whenever I try to run the query I always get a "Could Not Delete From Specified Table" error.
Here is the SQL statement:
DELETE [UCS (Currently Orbiting Satellites)].*, [UCS (Currently Orbiting Satellites)].[COSPAR Number], [UCS (Currently Orbiting Satellites)].ID
FROM [UCS (Currently Orbiting Satellites)] INNER JOIN [Distinct] ON [UCS (Currently Orbiting Satellites)].[COSPAR Number] = Distinct.[COSPAR Number]
WHERE ((([UCS (Currently Orbiting Satellites)].[COSPAR Number])=[Distinct].[COSPAR Number]) AND (([UCS (Currently Orbiting Satellites)].ID)<>[Distinct].[MaxOfID]));
[UCS (Currently Orbiting Satellites)] - This is the table that contains the duplicate records
[Distinct] - This is the totals query
As it can be seen, I am using COSPAR Number as the field that determines which records are duplicates, and ID fields to help separate older and newer entries of the records (Since the ID field is an AutoNumber format). Can anyone see if there is something wrong with the SQL? Just to add, I also created a relationship between the COSPAR Number fields of both [UCS (Currently Orbiting Satellites)] table and [Distinct] query.
I would really appreciate it if anyone could offer a solution!
I am trying to run a delete query that removes duplicate records in a table. However, whenever I try to run the query I always get a "Could Not Delete From Specified Table" error.
Here is the SQL statement:
DELETE [UCS (Currently Orbiting Satellites)].*, [UCS (Currently Orbiting Satellites)].[COSPAR Number], [UCS (Currently Orbiting Satellites)].ID
FROM [UCS (Currently Orbiting Satellites)] INNER JOIN [Distinct] ON [UCS (Currently Orbiting Satellites)].[COSPAR Number] = Distinct.[COSPAR Number]
WHERE ((([UCS (Currently Orbiting Satellites)].[COSPAR Number])=[Distinct].[COSPAR Number]) AND (([UCS (Currently Orbiting Satellites)].ID)<>[Distinct].[MaxOfID]));
[UCS (Currently Orbiting Satellites)] - This is the table that contains the duplicate records
[Distinct] - This is the totals query
As it can be seen, I am using COSPAR Number as the field that determines which records are duplicates, and ID fields to help separate older and newer entries of the records (Since the ID field is an AutoNumber format). Can anyone see if there is something wrong with the SQL? Just to add, I also created a relationship between the COSPAR Number fields of both [UCS (Currently Orbiting Satellites)] table and [Distinct] query.
I would really appreciate it if anyone could offer a solution!