SQLite Forum

Delete duplicate rows with an extra character
Login
Here is how to get the rowid for delete candidates:<code>
  SELECT x.rowid FROM players x, players y
  WHERE substr(x.player_tag,2)=y.player_tag
   AND substr(x.player_tag,1,1) IN ('#');
</code>. Calling that query "Extras", the delete is:<code>
  DELETE FROM players WHERE rowid IN (Extras);
</code>. It helps here that each row has a unique [rowid](https://sqlite.org/rowidtable.html).