Hi, I ran a find duplicates query based on my field name [CTV_ID]. So now that I can see how many duplicate records I have, is there anyway to delete all but one?
I don't know if this will help, my situation sounds similar and here's how I dealt with it. I'm sure there's a more elegant way but this worked well for me.
I have to import data into TableA - this is the one with the duplicates. I want to copy rows into TableB but only if the row doesn't already exist in TableB. In my case, I use the primary key to help with this.
Code:
INSERT INTO TableB
SELECT *
FROM TableA
WHERE (PrimaryKey NOT IN
(SELECT TableB.PrimaryKey
FROM TableB))
This sort of makes TableA a prep table. Again, this might not apply to your situation but it works for me.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.