samedi 25 avril 2015

SQLite - How to remove rows that have a string cell value contained in other rows?

I have this table in a SQLite database:

-----------------------------
id | string |...other columns
-----------------------------
01 |     AA |...
02 |    AAB |...
03 |     AB |...
04 |    BAB |...

What I need to do is to remove all the rows where the cell value of the column "string" is contained in any other row.

In the example above, row id-1 string is contained in row id-2 string and row id-3 string is contained in both row id-2 and id-4 strings.

So the final result should be:

-----------------------------
id | string |...other columns
-----------------------------
02 |    AAB |...
04 |    BAB |...

Is there an easy query to perform this operation?

Aucun commentaire:

Enregistrer un commentaire