Take this table.
id | sentence
-------------------
2 | I % cake.
3 | My name is %
You will notice the wildcards are actually in the fields within the database.
With MySQL you can do this :
SELECT id FROM mytable WHERE sentence LIKE 'My name is John';
In this example this would return 3.
So it's like a regular LIKE but in reverse.
My question is can this be done any way in SQLite, because when I try it I get no results. Is there a way to implement it perhaps if not ?
EDIT: Sorry was getting my LIKE & MATCH mixed up. Corrected it.
sqlite doesn't support a so-called "reverse LIKE" operator (nor does MySQL, for that matter), but it does support what we might call a "reverse reverse LIKE" operator. Try this:
SELECT id FROM mytable WHERE 'My name is John' LIKE sentence;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With