6 replies
by dynanin
-- Last suggesting calls for posting a new -- table as follows:
INSERT INTO NEW ...
SELECT DISTINCT CUSTOMER_ID, MAX CONTACT_DT, MAX(....)
FROM OLD
GROUP BY CUSTOMER_ID
ORDER BY CUSTOMER_ID;
-- This works for now ...
by sparent
If you simply want to remove the duplicate rows, you can simply delete the duplicates right out of the table.
DELETE FROM old o1
WHERE EXISTS
(SELECT 1
FROM old o2
WHERE o2.customer_id = o1.customer_id
AND o2.contact_date > o1.contact_date)
You can first try the above as a SELECT statement first, until you're happy that you are in fact removing the correct rows.
by dynanin
by dynanin
This discussion is closed to new replies.
Trending IT Employment posts
Sort by Trending