mercredi 1 avril 2015

Comparing substrings in SQLite

I'm using SQLite to storage my data. I want to know if there is a way to compare something similar to this:



Table Persons
-----------
Name | "12 34 42"


So I want to compare only the substring 34. Using LIKE, wildcards, substr(X,Y) and instr(X,Y) always return the row but I don't want that:



select * from persons where substr('4', 1) > 0;

select * from persons where instr(name, '4') > 0;


Is there a way to only compare a substring in SQLite?


Aucun commentaire:

Enregistrer un commentaire