delete from tableName n where rowid != (select max(rowid) from tableName s where n.name=s.name and n.tid=s.tid)