Withdata Software

Producing high-quality database tools

Main menu

Skip to primary content
Skip to secondary content
  • Withdata Software
  • Blog
  • Categories
  • Tags

Tag Archives: Remove duplicate rows

Remove duplicate rows in Oracle

Posted on June 8, 2013 by Shiji Pan

How to delete all duplicate rows and leave only one of them, in Oracle? DELETE FROM my_table WHERE rowid not in (SELECT MIN(rowid) FROM my_table GROUP BY column1, column2, column3...) ; Where column1, column2, etc. is the key you want to use. Relative links: Remove duplicate rows in ... Read more

Posted in Oracle | Tagged Oracle, Remove duplicate rows

Remove duplicate rows in MySQL

Posted on May 31, 2013 by Shiji Pan

The primary key: id, the unique columns:  col_1, col_2, col_3 . You can use a temporary table, like: create temporary table temp_table (id int); insert temp_table (id) select id from your_table t1 where exists ( select * from your_table t2 ... Read more

Posted in Mysql | Tagged Mysql, Remove duplicate rows

Remove duplicate rows in SQL Server

Posted on May 31, 2013 by Shiji Pan

Assuming no nulls, you GROUP BY the unique columns (eg. col_1, col_2, col_3), and SELECT the MIN (or MAX) Row ID (eg. row_id) as the row to keep. Then, delete everything that didn’t have a row id: DELETE my_table FROM my_table LEFT OUTER JOIN ( SELECT MIN(row_id) as row_id, col_1, ... Read more

Posted in Sql Server | Tagged Remove duplicate rows, Sql Server

Recent Posts

  • Use Cases for Dumping to CSV
  • Convert Text to Speech by CSV / TSV
Withdata Software. ©2004 - 2025 All rights reserved.