0

Using SQLite is there a way of using the LIKE command where the search parameter could find results that would be considered a substring of itself

ie. a search parameter of "delicious and tasty fruit and cinnamon." could return "delicious and tasty" in a DESC order by length so that if delicious was also a returned result it would show up last.

searching for "delicious and tasty fruit and cinnamon." could return...

 delicious and tasty fruit
 delicious and tasty
 delicious
4

1 回答 1

0

You don't need LIKE for that:

SELECT * FROM [foo]
WHERE a = substr('delicious and tasty fruit and cinnamona', 1, length(a))
ORDER BY length(a) DESC
于 2013-11-11T09:53:25.527 回答