Corky Younger
Newbie
Points: 3
More actions
July 20, 2004 at 6:07 pm
#88171
I have a table with near duplicates. Column1 has Name and Column2 has a date. I want to delete all the entries where the name in Column1 is duplicated, but I want to keep the entry with the newest date.
Please Help
Allen Cui-55137
SSC Guru
Points: 51650
July 20, 2004 at 6:27 pm
#515370
delete from a
from TEST3 a join
(select cust_id, max(tran_date) as max_tran_date from TEST3
group by cust_id
having count(*) > 1) b
on a.cust_id = b.cust_id and a.tran_date < b.max_tran_date
Nelson
SSC Enthusiast
Points: 132
July 22, 2004 at 3:02 pm
#515772
Allen, can you please explain the statement.... there is only one table "A" where would test3 come from is that another temp table or something??
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply