delete from where rowid < (select max(rowid) from where .=.)
DELETE FROM where not in (SELECT min(Id) FROM group by )