General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Deleting duplicate records
My program had a bug and when inserted duplicate records. What SQL can I use to delete all the duplicates, but one?
To find the duplicates I would use the sql below, but only want where cnt_text > 1. Then I want to delete all the records but the lowest sequence number (seq).
select key, seq, desc, comp_dt, count(text) as cnt_text from tickler ;
where desc = "Letter" and comp_dt = date()-1 ;
order by key, seq ;
group by key
thanks
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only