On Wed, 2005-01-26 at 17:45 -0800, Clark Christensen wrote: > Hello all, > > I'm new to SQL, and SQLite, and I find myself needing to > identify duplicate records in a SQLite table (there are > about 2K duplicates in a 36K row table). Any suggestions > or magic SQL queries appreciated :-) >
I've used these queries to delete rows with the same GROUPING_FIELDS:
1) keep first inserted item:
delete from TABLE where rowid not in (select min(rowid) from TABLE group by GROUPING_FIELDS);
2) keep last inserted item:
delete from TABLE where rowid not in (select max(rowid) from TABLE group by GROUPING_FIELDS);
they *seem* to work as expected
bye,
stefano