sql - Deleting duplicate rows from sqlite database -
i have huge table - 36 million rows - in sqlite3.
in large table, there 2 columns
- hash - text
- d - real
however, of rows duplicates. is, both hash , d have same values.
also, if 2 hashes identical, values of d, 2 identical ds not imply 2 identical hashes
anyway, want delete duplicate rows. don't have primary key column because i'm idiot. what's fastest way this?
edit: delete dist rowid not in (select max(rowid) dist group hash);
appears trick.
you need way distinguish rows. based on comment, use special rowid column that.
to delete duplicates keeping lowest rowid per (hash,d):
delete yourtable rowid not in ( select min(rowid) yourtable group hash , d )
Comments
Post a Comment