Duplicated Rows No More

We all get by with a little help from our friends. Let us share a tech tip with you and offer you an opportunity to learn more from the Red Pill Analytics team.


I came across a table with some troublesome duplicated rows and wanted to remove these dups so I used an old query of mine that I keep in my back pocket for just such an occasion. Here’s the said query, just replace the table_name and the column name with the key column or columns that your table needs.

delete from   table_name 
where rowid in (
SELECT  rowid FROM table_name
group by rowid, column_name
minus
SELECT min(rowid) FROM table_name
group by column_name)
 

Check out our collection of tip posts here. Subscribe to have them delivered to your inbox here.

5 Responses to Duplicated Rows No More

Leave a Reply

Your email address will not be published. Required fields are marked *