Hi Everyone,
I'm trying to remove duplicate records from a table using one of the queries found in many posts here, but I can't seem to get it to work. I'd like to keep one record of the duplicate set and discard others. Most have just 2 total duplicates, but there are a few with 3 duplicates. The code I attempted was:
If I run the sub-select in isolation it produces the records with duplicates, so I can verify; however when running the entire query it does not delete any of the duplicates.
Any help is appreciated.
I'm trying to remove duplicate records from a table using one of the queries found in many posts here, but I can't seem to get it to work. I'd like to keep one record of the duplicate set and discard others. Most have just 2 total duplicates, but there are a few with 3 duplicates. The code I attempted was:
Code:
Delete *
From PV
WHERE Role & ObjectID NOT IN
(SELECT max(Role & ObjectID)
FROM PV
GROUP BY Role, ObjectID
HAVING count(Role & ObjectID) > 1);
If I run the sub-select in isolation it produces the records with duplicates, so I can verify; however when running the entire query it does not delete any of the duplicates.
Any help is appreciated.