Delete duplicate rows (don't delete all duplicate)
问题 I am using postgres. I want to delete Duplicate rows. The condition is that , 1 copy from the set of duplicate rows would not be deleted. i.e : if there are 5 duplicate records then 4 of them will be deleted. 回答1: Try the steps described in this article: Removing duplicates from a PostgreSQL database. It describes a situation when you have to deal with huge amount of data which isn't possible to group by . A simple solution would be this: DELETE FROM foo WHERE id NOT IN (SELECT min(id) --or