mercredi 14 octobre 2015

PHP PDO SQlite single query to find values with only one occurence, in rows with comma separated values

For example, I have the following table:

 id  Name - Target 
 1    A       B     
 2    C       D,G      
 3    E       D
 4    F       G,B
 5    L       M,D,B
 6    Q       G,N

I have an over 2 million records database, and I think I made an error by storing values with a comma inside a row. My goal is to query the whole database on the "Target" row, for unique, non-repeating values, in my example the query should return only "M" and "N", because "B", "D" and "G" are repeating..

Is there a single query line to get this done ?

Aucun commentaire:

Enregistrer un commentaire